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

Function checkExpressionWithTypeArguments

test/fixtures/snapshot/typescript.js:77350–77415  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

77348 getNonNullableType(checkExpression(node.expression));
77349 }
77350 function checkExpressionWithTypeArguments(node) {
77351 checkGrammarExpressionWithTypeArguments(node);
77352 var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) :
77353 ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) :
77354 checkExpression(node.exprName);
77355 var typeArguments = node.typeArguments;
77356 if (exprType === silentNeverType || isErrorType(exprType) || !ts.some(typeArguments)) {
77357 return exprType;
77358 }
77359 var hasSomeApplicableSignature = false;
77360 var nonApplicableType;
77361 var result = getInstantiatedType(exprType);
77362 var errorType = hasSomeApplicableSignature ? nonApplicableType : exprType;
77363 if (errorType) {
77364 diagnostics.add(ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable, typeToString(errorType)));
77365 }
77366 return result;
77367 function getInstantiatedType(type) {
77368 var hasSignatures = false;
77369 var hasApplicableSignature = false;
77370 var result = getInstantiatedTypePart(type);
77371 hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature);
77372 if (hasSignatures && !hasApplicableSignature) {
77373 nonApplicableType !== null && nonApplicableType !== void 0 ? nonApplicableType : (nonApplicableType = type);
77374 }
77375 return result;
77376 function getInstantiatedTypePart(type) {
77377 if (type.flags & 524288 /* TypeFlags.Object */) {
77378 var resolved = resolveStructuredTypeMembers(type);
77379 var callSignatures = getInstantiatedSignatures(resolved.callSignatures);
77380 var constructSignatures = getInstantiatedSignatures(resolved.constructSignatures);
77381 hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0);
77382 hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0);
77383 if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) {
77384 var result_11 = createAnonymousType(undefined, resolved.members, callSignatures, constructSignatures, resolved.indexInfos);
77385 result_11.objectFlags |= 8388608 /* ObjectFlags.InstantiationExpressionType */;
77386 result_11.node = node;
77387 return result_11;
77388 }
77389 }
77390 else if (type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */) {
77391 var constraint = getBaseConstraintOfType(type);
77392 if (constraint) {
77393 var instantiated = getInstantiatedTypePart(constraint);
77394 if (instantiated !== constraint) {
77395 return instantiated;
77396 }
77397 }
77398 }
77399 else if (type.flags & 1048576 /* TypeFlags.Union */) {
77400 return mapType(type, getInstantiatedType);
77401 }
77402 else if (type.flags & 2097152 /* TypeFlags.Intersection */) {
77403 return getIntersectionType(ts.sameMap(type.types, getInstantiatedTypePart));
77404 }
77405 return type;
77406 }
77407 }

Callers 2

getTypeFromTypeQueryNodeFunction · 0.85
checkExpressionWorkerFunction · 0.85

Calls 8

checkThisExpressionFunction · 0.85
isErrorTypeFunction · 0.85
getInstantiatedTypeFunction · 0.85
typeToStringFunction · 0.85
someMethod · 0.80
checkExpressionFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…