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
Playground link with relevant code
class A { greet() {} } class C { constructor() { return new A(); } } let instance: A = new C() // error
Property 'greet' is missing in type 'C' but required in type 'A'.(2741)
I think that compiler should infer that the constructor will return an instance of a different class
The text was updated successfully, but these errors were encountered:
Duplicate of #27594 (IMO). Currently constructors can't have a different return type, and that's the issue to solve it.
Related: #13819
Sorry, something went wrong.
Sorry for that, you are right. It is a duplicate. Closing for now.
No branches or pull requests
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Property 'greet' is missing in type 'C' but required in type 'A'.(2741)
π Expected behavior
I think that compiler should infer that the constructor will return an instance of a different class
The text was updated successfully, but these errors were encountered: