We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
TypeScript Version: 3.0.0-dev.20180628
Search Terms: infer nested type object
Code
class Foo<A> { private a: A; } class ObjectFoo<A> extends Foo<A> { constructor(private b: { [k in keyof A]: Foo<A[k]> }) { super(); } } const a = new ObjectFoo({ b: new Foo<string>() }); const obj = new ObjectFoo({ a });
Expected behavior: Expect obj to have type { a: { b: string } }
obj
{ a: { b: string } }
Actual behavior: obj has type { a: { b: any } }
{ a: { b: any } }
Playground Link: playground
Related Issues:
The text was updated successfully, but these errors were encountered:
This is just a bug in the typeToString code; the actual type of b is string
b
string
Duplicate of #23897
Sorry, something went wrong.
@RyanCavanaugh so the actual type is inferred for multiple layers of nested objects? :) Thank you, I will follow that issue, feel free to close this!
Yep, you can try in the Playground - the properties of string will show up on obj.a.a.b (once you remove the private modifier)
obj.a.a.b
private
No branches or pull requests
TypeScript Version: 3.0.0-dev.20180628
Search Terms: infer nested type object
Code
Expected behavior:
Expect
obj
to have type{ a: { b: string } }
Actual behavior:
obj
has type{ a: { b: any } }
Playground Link:
playground
Related Issues:
The text was updated successfully, but these errors were encountered: