mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-27 04:46:25 -05:00
Fix recursive type inference (#53396)
This commit is contained in:
@@ -33,4 +33,14 @@ const foo2 = getIds([{
|
||||
id: 'b',
|
||||
children: []
|
||||
}]
|
||||
}] as const)
|
||||
}] as const)
|
||||
|
||||
// Repro from comment in #49226
|
||||
|
||||
type T1<T> = [number, T1<{ x: T }>];
|
||||
type T2<T> = [42, T2<{ x: T }>];
|
||||
|
||||
function qq<U>(x: T1<U>, y: T2<U>) {
|
||||
x = y;
|
||||
y = x; // Error
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ declare function foo<T>(x: Box1<Box1<T>>): T;
|
||||
|
||||
declare let z: Box2<Box2<string>>;
|
||||
|
||||
foo(z); // unknown, but ideally would be string (requires unique recursion ID for each type reference)
|
||||
foo(z); // string
|
||||
|
||||
// Intersect tuple element types
|
||||
|
||||
|
||||
Reference in New Issue
Block a user