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

Function fillMissingTypeArguments

test/fixtures/snapshot/typescript.js:59596–59620  ·  view source on GitHub ↗
(typeArguments, typeParameters, minTypeArgumentCount, isJavaScriptImplicitAny)

Source from the content-addressed store, hash-verified

59594 return minTypeArgumentCount;
59595 }
59596 function fillMissingTypeArguments(typeArguments, typeParameters, minTypeArgumentCount, isJavaScriptImplicitAny) {
59597 var numTypeParameters = ts.length(typeParameters);
59598 if (!numTypeParameters) {
59599 return [];
59600 }
59601 var numTypeArguments = ts.length(typeArguments);
59602 if (isJavaScriptImplicitAny || (numTypeArguments >= minTypeArgumentCount && numTypeArguments <= numTypeParameters)) {
59603 var result = typeArguments ? typeArguments.slice() : [];
59604 // Map invalid forward references in default types to the error type
59605 for (var i = numTypeArguments; i < numTypeParameters; i++) {
59606 result[i] = errorType;
59607 }
59608 var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny);
59609 for (var i = numTypeArguments; i < numTypeParameters; i++) {
59610 var defaultType = getDefaultFromTypeParameter(typeParameters[i]);
59611 if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) {
59612 defaultType = anyType;
59613 }
59614 result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType;
59615 }
59616 result.length = typeParameters.length;
59617 return result;
59618 }
59619 return typeArguments && typeArguments.slice();
59620 }
59621 function getSignatureFromDeclaration(declaration) {
59622 var links = getNodeLinks(declaration);
59623 if (!links.resolvedSignature) {

Calls 7

isTypeIdenticalToFunction · 0.85
instantiateTypeFunction · 0.85
createTypeMapperFunction · 0.85
sliceMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected