MCPcopy Create free account
hub / github.com/nodejs/node / getLiteralTypeFromProperty

Function getLiteralTypeFromProperty

test/fixtures/snapshot/typescript.js:61825–61838  ·  view source on GitHub ↗
(prop, include, includeNonPublic)

Source from the content-addressed store, hash-verified

61823 getRegularTypeOfLiteralType(ts.isComputedPropertyName(name) ? checkComputedPropertyName(name) : checkExpression(name));
61824 }
61825 function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
61826 if (includeNonPublic || !(ts.getDeclarationModifierFlagsFromSymbol(prop) & 24 /* ModifierFlags.NonPublicAccessibilityModifier */)) {
61827 var type = getSymbolLinks(getLateBoundSymbol(prop)).nameType;
61828 if (!type) {
61829 var name = ts.getNameOfDeclaration(prop.valueDeclaration);
61830 type = prop.escapedName === "default" /* InternalSymbolName.Default */ ? getStringLiteralType("default") :
61831 name && getLiteralTypeFromPropertyName(name) || (!ts.isKnownSymbol(prop) ? getStringLiteralType(ts.symbolName(prop)) : undefined);
61832 }
61833 if (type && type.flags & include) {
61834 return type;
61835 }
61836 }
61837 return neverType;
61838 }
61839 function isKeyTypeIncluded(keyType, include) {
61840 return !!(keyType.flags & include || keyType.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(keyType.types, function (t) { return isKeyTypeIncluded(t, include); }));
61841 }

Calls 4

getSymbolLinksFunction · 0.85
getLateBoundSymbolFunction · 0.85
getStringLiteralTypeFunction · 0.85

Tested by

no test coverage detected