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

Function unwrapArrayItemType

packages/transpiler/src/BuilderHelpers.ts:57–75  ·  view source on GitHub ↗
(type: ts.Type, typeChecker: ts.TypeChecker)

Source from the content-addressed store, hash-verified

55}
56
57export function unwrapArrayItemType(type: ts.Type, typeChecker: ts.TypeChecker): ts.Type | null {
58 if (type.symbol && type.symbol.name === 'Array') {
59 return (type as ts.TypeReference).typeArguments![0];
60 }
61
62 if (isPrimitiveType(type)) {
63 return null;
64 }
65
66 if (type.isUnion()) {
67 const nonNullable = typeChecker.getNonNullableType(type);
68 if (type === nonNullable) {
69 return null;
70 }
71 return unwrapArrayItemType(nonNullable, typeChecker);
72 }
73
74 return null;
75}
76
77export function isPrimitiveType(type: ts.Type | null) {
78 if (!type) {

Callers

nothing calls this directly

Calls 1

isPrimitiveTypeFunction · 0.85

Tested by

no test coverage detected