MCPcopy Create free account
hub / github.com/nodejs/node / getLiteralTypeFromProperties

Function getLiteralTypeFromProperties

test/fixtures/snapshot/typescript.js:61842–61849  ·  view source on GitHub ↗
(type, include, includeOrigin)

Source from the content-addressed store, hash-verified

61840 return !!(keyType.flags & include || keyType.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(keyType.types, function (t) { return isKeyTypeIncluded(t, include); }));
61841 }
61842 function getLiteralTypeFromProperties(type, include, includeOrigin) {
61843 var origin = includeOrigin && (ts.getObjectFlags(type) & (3 /* ObjectFlags.ClassOrInterface */ | 4 /* ObjectFlags.Reference */) || type.aliasSymbol) ? createOriginIndexType(type) : undefined;
61844 var propertyTypes = ts.map(getPropertiesOfType(type), function (prop) { return getLiteralTypeFromProperty(prop, include); });
61845 var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ?
61846 info.keyType === stringType && include & 8 /* TypeFlags.Number */ ? stringOrNumberType : info.keyType : neverType; });
61847 return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* UnionReduction.Literal */,
61848 /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin);
61849 }
61850 /**
61851 * A union type which is reducible upon instantiation (meaning some members are removed under certain instantiations)
61852 * must be kept generic, as that instantiation information needs to flow through the type system. By replacing all

Callers 1

getIndexTypeFunction · 0.85

Calls 7

createOriginIndexTypeFunction · 0.85
getPropertiesOfTypeFunction · 0.85
getIndexInfosOfTypeFunction · 0.85
isKeyTypeIncludedFunction · 0.85
getUnionTypeFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected