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

Function compareTypePredicateRelatedTo

test/fixtures/snapshot/typescript.js:64459–64483  ·  view source on GitHub ↗
(source, target, reportErrors, errorReporter, compareTypes)

Source from the content-addressed store, hash-verified

64457 return result;
64458 }
64459 function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) {
64460 if (source.kind !== target.kind) {
64461 if (reportErrors) {
64462 errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard);
64463 errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));
64464 }
64465 return 0 /* Ternary.False */;
64466 }
64467 if (source.kind === 1 /* TypePredicateKind.Identifier */ || source.kind === 3 /* TypePredicateKind.AssertsIdentifier */) {
64468 if (source.parameterIndex !== target.parameterIndex) {
64469 if (reportErrors) {
64470 errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, source.parameterName, target.parameterName);
64471 errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));
64472 }
64473 return 0 /* Ternary.False */;
64474 }
64475 }
64476 var related = source.type === target.type ? -1 /* Ternary.True */ :
64477 source.type && target.type ? compareTypes(source.type, target.type, reportErrors) :
64478 0 /* Ternary.False */;
64479 if (related === 0 /* Ternary.False */ && reportErrors) {
64480 errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));
64481 }
64482 return related;
64483 }
64484 function isImplementationCompatibleWithOverload(implementation, overload) {
64485 var erasedSource = getErasedSignature(implementation);
64486 var erasedTarget = getErasedSignature(overload);

Callers 1

compareSignaturesRelatedFunction · 0.85

Calls 1

typePredicateToStringFunction · 0.85

Tested by

no test coverage detected