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

Function getPropertyOfType

test/fixtures/snapshot/typescript.js:59403–59429  ·  view source on GitHub ↗

* Return the symbol for the property with the given name in the given type. Creates synthetic union properties when * necessary, maps primitive types and type parameters are to their apparent types, and augments with properties from * Object and Function as appropriate. *

(type, name, skipObjectFunctionPropertyAugment)

Source from the content-addressed store, hash-verified

59401 * @param name a name of property to look up in a given type
59402 */
59403 function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment) {
59404 type = getReducedApparentType(type);
59405 if (type.flags & 524288 /* TypeFlags.Object */) {
59406 var resolved = resolveStructuredTypeMembers(type);
59407 var symbol = resolved.members.get(name);
59408 if (symbol && symbolIsValue(symbol)) {
59409 return symbol;
59410 }
59411 if (skipObjectFunctionPropertyAugment)
59412 return undefined;
59413 var functionType = resolved === anyFunctionType ? globalFunctionType :
59414 resolved.callSignatures.length ? globalCallableFunctionType :
59415 resolved.constructSignatures.length ? globalNewableFunctionType :
59416 undefined;
59417 if (functionType) {
59418 var symbol_1 = getPropertyOfObjectType(functionType, name);
59419 if (symbol_1) {
59420 return symbol_1;
59421 }
59422 }
59423 return getPropertyOfObjectType(globalObjectType, name);
59424 }
59425 if (type.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
59426 return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
59427 }
59428 return undefined;
59429 }
59430 function getSignaturesOfStructuredType(type, kind) {
59431 if (type.flags & 3670016 /* TypeFlags.StructuredType */) {
59432 var resolved = resolveStructuredTypeMembers(type);

Calls 6

getReducedApparentTypeFunction · 0.85
symbolIsValueFunction · 0.85
getPropertyOfObjectTypeFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected