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

Function distributeObjectOverIndexType

test/fixtures/snapshot/typescript.js:62295–62302  ·  view source on GitHub ↗
(objectType, indexType, writing)

Source from the content-addressed store, hash-verified

62293 }
62294 }
62295 function distributeObjectOverIndexType(objectType, indexType, writing) {
62296 // T[A | B] -> T[A] | T[B] (reading)
62297 // T[A | B] -> T[A] & T[B] (writing)
62298 if (indexType.flags & 1048576 /* TypeFlags.Union */) {
62299 var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); });
62300 return writing ? getIntersectionType(types) : getUnionType(types);
62301 }
62302 }
62303 // Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
62304 // the type itself if no transformation is possible. The writing flag indicates that the type is
62305 // the target of an assignment.

Callers 1

Calls 5

getSimplifiedTypeFunction · 0.85
getIndexedAccessTypeFunction · 0.85
getIntersectionTypeFunction · 0.85
getUnionTypeFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…