MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / isEnumType

Function isEnumType

packages/transpiler/src/BuilderHelpers.ts:113–130  ·  view source on GitHub ↗
(type: ts.Type)

Source from the content-addressed store, hash-verified

111}
112
113export function isEnumType(type: ts.Type) {
114 // if for some reason this returns true...
115 if (hasFlag(type, ts.TypeFlags.Enum)) {
116 return true;
117 }
118 // it's not an enum type if it's an enum literal type
119 if (hasFlag(type, ts.TypeFlags.EnumLiteral)) {
120 return true;
121 }
122 // get the symbol and check if its value declaration is an enum declaration
123 const symbol = type.getSymbol();
124 if (!symbol) {
125 return false;
126 }
127 const { valueDeclaration } = symbol;
128
129 return valueDeclaration && valueDeclaration.kind === ts.SyntaxKind.EnumDeclaration;
130}
131
132export function wrapToNonNull(isNullableType: boolean, expr: ts.Expression, factory: ts.NodeFactory) {
133 return isNullableType ? expr : factory.createNonNullExpression(expr);

Callers 2

fillBaseInfoFromFunction · 0.90
getTypeWithNullableInfoFunction · 0.90

Calls 2

hasFlagFunction · 0.70
getSymbolMethod · 0.45

Tested by

no test coverage detected