gen_js_api
gen_js_api copied to clipboard
Unions based on JS class name and typeof?
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.