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

Function reportErrorResults

test/fixtures/snapshot/typescript.js:65101–65142  ·  view source on GitHub ↗
(originalSource, originalTarget, source, target, headMessage)

Source from the content-addressed store, hash-verified

65099 return 0 /* Ternary.False */;
65100 }
65101 function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
65102 var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
65103 var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
65104 source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
65105 target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
65106 var maybeSuppress = overrideNextErrorInfo > 0;
65107 if (maybeSuppress) {
65108 overrideNextErrorInfo--;
65109 }
65110 if (source.flags & 524288 /* TypeFlags.Object */ && target.flags & 524288 /* TypeFlags.Object */) {
65111 var currentError = errorInfo;
65112 tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ true);
65113 if (errorInfo !== currentError) {
65114 maybeSuppress = !!errorInfo;
65115 }
65116 }
65117 if (source.flags & 524288 /* TypeFlags.Object */ && target.flags & 131068 /* TypeFlags.Primitive */) {
65118 tryElaborateErrorsForPrimitivesAndObjects(source, target);
65119 }
65120 else if (source.symbol && source.flags & 524288 /* TypeFlags.Object */ && globalObjectType === source) {
65121 reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
65122 }
65123 else if (ts.getObjectFlags(source) & 2048 /* ObjectFlags.JsxAttributes */ && target.flags & 2097152 /* TypeFlags.Intersection */) {
65124 var targetTypes = target.types;
65125 var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
65126 var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
65127 if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
65128 (ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
65129 // do not report top error
65130 return;
65131 }
65132 }
65133 else {
65134 errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
65135 }
65136 if (!headMessage && maybeSuppress) {
65137 lastSkippedInfo = [source, target];
65138 // Used by, eg, missing property checking to replace the top-level message with a more informative one
65139 return;
65140 }
65141 reportRelationError(headMessage, source, target);
65142 }
65143 function traceUnionsOrIntersectionsTooLarge(source, target) {
65144 if (!ts.tracing) {
65145 return;

Callers 1

isRelatedToFunction · 0.85

Calls 9

reportErrorFunction · 0.85
getJsxTypeFunction · 0.85
isErrorTypeFunction · 0.85
reportRelationErrorFunction · 0.85
containsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…