tests/cases/compiler/deepComparisons.ts(2,9): error TS2322: Type 'T' is not assignable to type 'Extract'. tests/cases/compiler/deepComparisons.ts(3,9): error TS2322: Type 'T[K1]' is not assignable to type 'Extract'. Type 'T[keyof T]' is not assignable to type 'Extract'. Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'Extract'. Type 'T[string]' is not assignable to type 'Extract'. tests/cases/compiler/deepComparisons.ts(4,9): error TS2322: Type 'T[K1][K2]' is not assignable to type 'Extract'. Type 'T[K1][keyof T[K1]]' is not assignable to type 'Extract'. Type 'T[K1][string] | T[K1][number] | T[K1][symbol]' is not assignable to type 'Extract'. Type 'T[K1][string]' is not assignable to type 'Extract'. Type 'T[keyof T][string]' is not assignable to type 'Extract'. Type 'T[string][string] | T[number][string] | T[symbol][string]' is not assignable to type 'Extract'. Type 'T[string][string]' is not assignable to type 'Extract'. ==== tests/cases/compiler/deepComparisons.ts (3 errors) ==== function f1() { let v1: Extract = 0 as any as T; // Error ~~ !!! error TS2322: Type 'T' is not assignable to type 'Extract'. let v2: Extract = 0 as any as T[K1]; // Error ~~ !!! error TS2322: Type 'T[K1]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[string]' is not assignable to type 'Extract'. let v3: Extract = 0 as any as T[K1][K2]; // No error ~~ !!! error TS2322: Type 'T[K1][K2]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[K1][keyof T[K1]]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[K1][string] | T[K1][number] | T[K1][symbol]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[K1][string]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[keyof T][string]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[string][string] | T[number][string] | T[symbol][string]' is not assignable to type 'Extract'. !!! error TS2322: Type 'T[string][string]' is not assignable to type 'Extract'. } type Foo = { x: Foo }; type Bar = { x: Bar }; function f2() { let x: Foo = 0 as any as Bar; // Error, excessive stack depth } type Foo1 = { x: Foo2 }; type Foo2 = { x: Foo1 }; function f3() { let x: Foo1 = 0 as any as Bar; // No error! } // Repro from #46500 type F = {} & ( T extends [any, ...any[]] ? { [K in keyof T]?: F } : T extends any[] ? F[] : T extends { [K: string]: any } ? { [K in keyof T]?: F } : { x: string } ); declare function f(): F; function g() { return f() as F; }