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

Function getTypeWithSyntheticDefaultImportType

test/fixtures/snapshot/typescript.js:77223–77243  ·  view source on GitHub ↗
(type, symbol, originalSymbol, moduleSpecifier)

Source from the content-addressed store, hash-verified

77221 return undefined;
77222 }
77223 function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
77224 var _a;
77225 if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
77226 var synthType = type;
77227 if (!synthType.syntheticType) {
77228 var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
77229 var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, /*dontResolveAlias*/ false, moduleSpecifier);
77230 if (hasSyntheticDefault) {
77231 var anonymousSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
77232 var defaultContainingObject = createDefaultPropertyWrapperForModule(symbol, originalSymbol, anonymousSymbol);
77233 anonymousSymbol.type = defaultContainingObject;
77234 synthType.syntheticType = isValidSpreadType(type) ? getSpreadType(type, defaultContainingObject, anonymousSymbol, /*objectFlags*/ 0, /*readonly*/ false) : defaultContainingObject;
77235 }
77236 else {
77237 synthType.syntheticType = type;
77238 }
77239 }
77240 return synthType.syntheticType;
77241 }
77242 return type;
77243 }
77244 function isCommonJsRequire(node) {
77245 if (!ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true)) {
77246 return false;

Callers 2

resolveESModuleSymbolFunction · 0.85

Calls 7

isErrorTypeFunction · 0.85
canHaveSyntheticDefaultFunction · 0.85
createSymbolFunction · 0.85
isValidSpreadTypeFunction · 0.85
getSpreadTypeFunction · 0.85
findMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…