* Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct * an object type with the same set of properties as the source type, where the type of each * property is computed by inferring from the source property type to X for the type *
(source, target, constraint)
| 68192 | * variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for). |
| 68193 | */ |
| 68194 | function inferTypeForHomomorphicMappedType(source, target, constraint) { |
| 68195 | if (inInferTypeForHomomorphicMappedType) { |
| 68196 | return undefined; |
| 68197 | } |
| 68198 | var key = source.id + "," + target.id + "," + constraint.id; |
| 68199 | if (reverseMappedCache.has(key)) { |
| 68200 | return reverseMappedCache.get(key); |
| 68201 | } |
| 68202 | inInferTypeForHomomorphicMappedType = true; |
| 68203 | var type = createReverseMappedType(source, target, constraint); |
| 68204 | inInferTypeForHomomorphicMappedType = false; |
| 68205 | reverseMappedCache.set(key, type); |
| 68206 | return type; |
| 68207 | } |
| 68208 | // We consider a type to be partially inferable if it isn't marked non-inferable or if it is |
| 68209 | // an object literal type with at least one property of an inferable type. For example, an object |
| 68210 | // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive |
no test coverage detected