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

Function typeCouldHaveTopLevelSingletonTypes

test/fixtures/snapshot/typescript.js:66869–66886  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

66867 }
66868 }
66869 function typeCouldHaveTopLevelSingletonTypes(type) {
66870 // Okay, yes, 'boolean' is a union of 'true | false', but that's not useful
66871 // in error reporting scenarios. If you need to use this function but that detail matters,
66872 // feel free to add a flag.
66873 if (type.flags & 16 /* TypeFlags.Boolean */) {
66874 return false;
66875 }
66876 if (type.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
66877 return !!ts.forEach(type.types, typeCouldHaveTopLevelSingletonTypes);
66878 }
66879 if (type.flags & 465829888 /* TypeFlags.Instantiable */) {
66880 var constraint = getConstraintOfType(type);
66881 if (constraint && constraint !== type) {
66882 return typeCouldHaveTopLevelSingletonTypes(constraint);
66883 }
66884 }
66885 return isUnitType(type) || !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */);
66886 }
66887 function getExactOptionalUnassignableProperties(source, target) {
66888 if (isTupleType(source) && isTupleType(target))
66889 return ts.emptyArray;

Callers 1

reportRelationErrorFunction · 0.85

Calls 3

getConstraintOfTypeFunction · 0.85
isUnitTypeFunction · 0.85
forEachMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…