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? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Version: Nightly (v4.1.0-dev.20201029)
Search Terms: extended class property initializer extended class property function
Code
class A { declare test: (foo: string) => string } class B extends A { test = bar => bar }
or
class A { test = (foo: string) => foo } class B extends A { test = bar => bar }
Expected behavior: In class B the bar parameter should be inferred as string
bar
string
Actual behavior: Parameter 'bar' implicitly has an 'any' type.
Playground Link: https://www.typescriptlang.org/play?ts=4.1.0-dev.20201029#code/MYGwhgzhAECC0G8CwAoa0AuBTCHoF5oAKAMwHsyAuaXAJwEsA7AcwEoCA+acs1AX1SpQkGACFoWAB7ZGAExjxkaaMDKM6AV2AYytIuyXp0EDQAcse1qiOYAFvQgA6bLgLcKnd72UCUvoA
Related Issues: Not that I could find
This does work:
class A { test = (foo: string) => foo } class B extends A { constructor() { super() this.test = bar => bar } }
The text was updated successfully, but these errors were encountered:
See #10570
Sorry, something went wrong.
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
No branches or pull requests
TypeScript Version: Nightly (v4.1.0-dev.20201029)
Search Terms:
extended class property initializer
extended class property function
Code
or
Expected behavior:
In class B the
bar
parameter should be inferred asstring
Actual behavior:
Parameter 'bar' implicitly has an 'any' type.
Playground Link:
https://www.typescriptlang.org/play?ts=4.1.0-dev.20201029#code/MYGwhgzhAECC0G8CwAoa0AuBTCHoF5oAKAMwHsyAuaXAJwEsA7AcwEoCA+acs1AX1SpQkGACFoWAB7ZGAExjxkaaMDKM6AV2AYytIuyXp0EDQAcse1qiOYAFvQgA6bLgLcKnd72UCUvoA
Related Issues:
Not that I could find
This does work:
The text was updated successfully, but these errors were encountered: