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

Function instantiateTypeWithAlias

test/fixtures/snapshot/typescript.js:63631–63649  ·  view source on GitHub ↗
(type, mapper, aliasSymbol, aliasTypeArguments)

Source from the content-addressed store, hash-verified

63629 return type && mapper ? instantiateTypeWithAlias(type, mapper, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined) : type;
63630 }
63631 function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
63632 if (!couldContainTypeVariables(type)) {
63633 return type;
63634 }
63635 if (instantiationDepth === 100 || instantiationCount >= 5000000) {
63636 // We have reached 100 recursive type instantiations, or 5M type instantiations caused by the same statement
63637 // or expression. There is a very high likelyhood we're dealing with a combination of infinite generic types
63638 // that perpetually generate new type identities, so we stop the recursion here by yielding the error type.
63639 ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes" /* tracing.Phase.CheckTypes */, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth: instantiationDepth, instantiationCount: instantiationCount });
63640 error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63641 return errorType;
63642 }
63643 totalInstantiationCount++;
63644 instantiationCount++;
63645 instantiationDepth++;
63646 var result = instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments);
63647 instantiationDepth--;
63648 return result;
63649 }
63650 function instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments) {
63651 var flags = type.flags;
63652 if (flags & 262144 /* TypeFlags.TypeParameter */) {

Callers 2

instantiateTypeFunction · 0.85

Calls 3

instantiateTypeWorkerFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected