MCPcopy Index your code
hub / github.com/nodejs/node / getOrCreateTypeFromSignature

Function getOrCreateTypeFromSignature

test/fixtures/snapshot/typescript.js:60003–60022  ·  view source on GitHub ↗
(signature)

Source from the content-addressed store, hash-verified

60001 return signature;
60002 }
60003 function getOrCreateTypeFromSignature(signature) {
60004 var _a;
60005 // There are two ways to declare a construct signature, one is by declaring a class constructor
60006 // using the constructor keyword, and the other is declaring a bare construct signature in an
60007 // object type literal or interface (using the new keyword). Each way of declaring a constructor
60008 // will result in a different declaration kind.
60009 if (!signature.isolatedSignatureType) {
60010 var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind;
60011 // If declaration is undefined, it is likely to be the signature of the default constructor.
60012 var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */;
60013 var type = createObjectType(16 /* ObjectFlags.Anonymous */);
60014 type.members = emptySymbols;
60015 type.properties = ts.emptyArray;
60016 type.callSignatures = !isConstructor ? [signature] : ts.emptyArray;
60017 type.constructSignatures = isConstructor ? [signature] : ts.emptyArray;
60018 type.indexInfos = ts.emptyArray;
60019 signature.isolatedSignatureType = type;
60020 }
60021 return signature.isolatedSignatureType;
60022 }
60023 function getIndexSymbol(symbol) {
60024 return symbol.members ? getIndexSymbolFromSymbolTable(symbol.members) : undefined;
60025 }

Calls 1

createObjectTypeFunction · 0.85

Tested by

no test coverage detected