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

Function isJSConstructor

test/fixtures/snapshot/typescript.js:76957–76974  ·  view source on GitHub ↗

* Indicates whether a declaration can be treated as a constructor in a JavaScript * file.

(node)

Source from the content-addressed store, hash-verified

76955 * file.
76956 */
76957 function isJSConstructor(node) {
76958 var _a;
76959 if (!node || !ts.isInJSFile(node)) {
76960 return false;
76961 }
76962 var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
76963 ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
76964 undefined;
76965 if (func) {
76966 // If the node has a @class tag, treat it like a constructor.
76967 if (ts.getJSDocClassTag(node))
76968 return true;
76969 // If the symbol of the node has members, treat it like a constructor.
76970 var symbol = getSymbolOfNode(func);
76971 return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
76972 }
76973 return false;
76974 }
76975 function mergeJSSymbols(target, source) {
76976 var _a, _b;
76977 if (source) {

Callers 15

createAnonymousTypeNodeFunction · 0.85
getDeclaringConstructorFunction · 0.85
getOuterTypeParametersFunction · 0.85
getThisTypeFunction · 0.85
compareSignaturesRelatedFunction · 0.85
signaturesRelatedToFunction · 0.85
tryGetThisTypeAtFunction · 0.85
resolveNewExpressionFunction · 0.85

Calls 1

getSymbolOfNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…