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

Function getMappedType

test/fixtures/snapshot/typescript.js:63282–63302  ·  view source on GitHub ↗
(type, mapper)

Source from the content-addressed store, hash-verified

63280 return sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : makeArrayTypeMapper(sources, targets);
63281 }
63282 function getMappedType(type, mapper) {
63283 switch (mapper.kind) {
63284 case 0 /* TypeMapKind.Simple */:
63285 return type === mapper.source ? mapper.target : type;
63286 case 1 /* TypeMapKind.Array */:
63287 var sources = mapper.sources;
63288 var targets = mapper.targets;
63289 for (var i = 0; i < sources.length; i++) {
63290 if (type === sources[i]) {
63291 return targets ? targets[i] : anyType;
63292 }
63293 }
63294 return type;
63295 case 2 /* TypeMapKind.Function */:
63296 return mapper.func(type);
63297 case 3 /* TypeMapKind.Composite */:
63298 case 4 /* TypeMapKind.Merged */:
63299 var t1 = getMappedType(type, mapper.mapper1);
63300 return t1 !== type && mapper.kind === 3 /* TypeMapKind.Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
63301 }
63302 }
63303 function makeUnaryTypeMapper(source, target) {
63304 return { kind: 0 /* TypeMapKind.Simple */, source: source, target: target };
63305 }

Callers 6

lookupTypeParameterNodesFunction · 0.85
canTailRecurseFunction · 0.85
instantiateTypeWorkerFunction · 0.85

Calls 2

instantiateTypeFunction · 0.85
funcMethod · 0.45

Tested by

no test coverage detected