-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
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
inherit types from base class #52002
Comments
Duplicate of the more comprehensive proposal #36165 |
@fatcerberus do you have any plan to add this feature in upcoming versions? |
I’m not a TypeScript developer but maybe if you’re good Santa will bring you a new feature or two… probably not this one though |
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
@RyanCavanaugh when we'll see this fix in typescript? |
Suggestion
🔍 Search Terms
inheriting base types into child class without importing them manually
⭐ Suggestion
In
TypeScript v4.9.4
, if we extend a class from another file, we also need to import the corresponding types in order to access the base types. I propose that TypeScript should include a feature called "type inheritance" that allows us to access the base types without having to import them.📃 Motivating Example
Here are some issues with this code:-
It is unnecessary to import the types
Request
andResponse
in the child class if the base class has already been imported. This adds unnecessary code and complexity.There is no code intelligence in the child class to show which methods are defined in the base class, making it harder to understand and work with the code.
I think this is not a good idea to import types if we have already imported the class
Base
and also there is no code intelligence in the child class for which method to override or which already defines inside the base class.💻 Use Cases
Expected behavior:-
are defined in the base class. It would also throw an error if the method is not available in the base class.
The text was updated successfully, but these errors were encountered: