Fix mapped type instantiation circularity (#46586)

* Don't obtain constraint if doing so would cause circularity

* Add regression test

* Address CR feedback
This commit is contained in:
Anders Hejlsberg authored and GitHub committed 2021-10-29 14:01:27 -07:00
1 parent 28e3cd3a80
commit b0ab2a54bb
6 files changed
+77 -4

No files matched your search

@@ -53,4 +53,13 @@ declare function stringifyArray<T extends readonly any[]>(arr: T): { -readonly [
let abc: any[] = stringifyArray(void 0 as any);
declare function stringifyPair<T extends readonly [any, any]>(arr: T): { -readonly [K in keyof T]: string };
let def: [any, any] = stringifyPair(void 0 as any);
let def: [any, any] = stringifyPair(void 0 as any);
// Repro from #46582
type Evolvable<E extends Evolver> = {
[P in keyof E]: never;
};
type Evolver<T extends Evolvable<any> = any> = {
[key in keyof Partial<T>]: never;
};