Skip to content

Unions based on JS class name and typeof? #158

Description

@Lupus

TypeScript very often has the following unions defined:

export type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;

export interface TypeOperatorNode extends TypeNode {
        readonly kind: SyntaxKind.TypeOperator;
        readonly operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword;
        readonly type: TypeNode;
    }


getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): string | number | undefined;

Some of them can be discriminated by class constructor names, others can be discriminated by the type of value (string vs number for example). Currently gen_js_api does not seem to support this use cases. Would be great to have such feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions