File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -827,6 +827,7 @@ namespace ts {
827
827
/** Key is "/path/to/a.ts|/path/to/b.ts". */
828
828
let amalgamatedDuplicates: Map<DuplicateInfoForFiles> | undefined;
829
829
const reverseMappedCache = createMap<Type | undefined>();
830
+ let inInferTypeForHomomorphicMappedType = false;
830
831
let ambientModulesCache: Symbol[] | undefined;
831
832
/**
832
833
* List of every ambient module with a "*" wildcard.
@@ -18267,12 +18268,16 @@ namespace ts {
18267
18268
* variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for).
18268
18269
*/
18269
18270
function inferTypeForHomomorphicMappedType(source: Type, target: MappedType, constraint: IndexType): Type | undefined {
18271
+ if (inInferTypeForHomomorphicMappedType) {
18272
+ return undefined;
18273
+ }
18270
18274
const key = source.id + "," + target.id + "," + constraint.id;
18271
18275
if (reverseMappedCache.has(key)) {
18272
18276
return reverseMappedCache.get(key);
18273
18277
}
18274
- reverseMappedCache.set(key, undefined) ;
18278
+ inInferTypeForHomomorphicMappedType = true ;
18275
18279
const type = createReverseMappedType(source, target, constraint);
18280
+ inInferTypeForHomomorphicMappedType = false;
18276
18281
reverseMappedCache.set(key, type);
18277
18282
return type;
18278
18283
}
You can’t perform that action at this time.
0 commit comments