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

Function literalTypesWithSameBaseType

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

Source from the content-addressed store, hash-verified

67362 0 /* Ternary.False */;
67363 }
67364 function literalTypesWithSameBaseType(types) {
67365 var commonBaseType;
67366 for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
67367 var t = types_13[_i];
67368 var baseType = getBaseTypeOfLiteralType(t);
67369 if (!commonBaseType) {
67370 commonBaseType = baseType;
67371 }
67372 if (baseType === t || baseType !== commonBaseType) {
67373 return false;
67374 }
67375 }
67376 return true;
67377 }
67378 // When the candidate types are all literal types with the same base type, return a union
67379 // of those literal types. Otherwise, return the leftmost type for which no type to the
67380 // right is a supertype.

Callers 1

getSupertypeOrUnionFunction · 0.85

Calls 1

getBaseTypeOfLiteralTypeFunction · 0.85

Tested by

no test coverage detected