more accurate error message when derived class has different constructor signature #31046
Closed
5 tasks done
Labels
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Fixed
A PR has been merged for this issue
Milestone
Search Terms
abstract derived class constructor signature error message
Suggestion
Currently the following code:
will give you the following error:
Type 'typeof B' is not assignable to type 'typeof A'.
When you encountering this issue for the first time as a new typescript user, and you already have a bunch of code for both abstract and derived classes, it might be hard to track down what is causing the type error. So consider adding more specificity to the error message, smth like "Derived class should have the same constructor signature as a parent".
Use Cases
Currently error message is not clear enough.
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: