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

Function getCommonSupertype

test/fixtures/snapshot/typescript.js:67389–67397  ·  view source on GitHub ↗
(types)

Source from the content-addressed store, hash-verified

67387 ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(s, t) ? t : s; });
67388 }
67389 function getCommonSupertype(types) {
67390 if (!strictNullChecks) {
67391 return getSupertypeOrUnion(types);
67392 }
67393 var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304 /* TypeFlags.Nullable */); });
67394 return primaryTypes.length ?
67395 getNullableType(getSupertypeOrUnion(primaryTypes), getFalsyFlagsOfTypes(types) & 98304 /* TypeFlags.Nullable */) :
67396 getUnionType(types, 2 /* UnionReduction.Subtype */);
67397 }
67398 // Return the leftmost type for which no type to the right is a subtype.
67399 function getCommonSubtype(types) {
67400 return ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(t, s) ? t : s; });

Callers 1

getCovariantInferenceFunction · 0.85

Calls 5

getSupertypeOrUnionFunction · 0.85
getNullableTypeFunction · 0.85
getFalsyFlagsOfTypesFunction · 0.85
getUnionTypeFunction · 0.85
filterMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…