-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
Milestone
Description
π Search Terms
type parameter leak reverse mapped type type variable this
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
declare function test<T extends Record<string, unknown>>(obj: {
[K in keyof T]: () => T[K];
}): T;
const obj = test({
// ^? const obj: { a: number; b: T[string]; }
a() {
return 0;
},
b() {
return this.a();
},
});π Actual behavior
obj's type refers to T[string]
π Expected behavior
T definitely shouldn't leak into obj's type
Additional information about the issue
No response