-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
FixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 2.7.2
Search Terms:
Generic object type inference
Code
class Foo<A> {
constructor(private a: A) {}
}
type Bar<A extends object> = { [k in keyof A]: Foo<A[k]> };
class Baz<A extends object> {
constructor(private b: Bar<A>) {}
}
const foo = new Baz({ a: new Foo<string>("foo") });
const bar = new Baz<{a: string}>({ a: new Foo<string>("bar") });
Expected behavior:
Expected foo
to have type Baz<{a: string}>
.
Actual behavior:
foo
has type Baz<{a: any}>
Playground Link:
Typescript Playground
Related Issues:
Metadata
Metadata
Assignees
Labels
FixedA PR has been merged for this issueA PR has been merged for this issue