Allow extending types referenced through interfaces
See original GitHub issueSuggestion
Allow things like the following:
interface I extends HTMLElementTagNameMap['abbr'] {}
Currently, the following error message is given: “An interface can only extend an identifier/qualified-name with optional type arguments.” Which I don’t even understand.
I believe it requires no further clarification or justification, but please let me know if that is the case…
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Extending object-like types with interfaces in TypeScript
Extending multiple interfaces refers to the concept of composition where the interface is designed to extend attributes it needs. It differs ...
Read more >Possible to extend types in Typescript? - Stack Overflow
UPDATE for TypeScript 2.2, it's now possible to have an interface that extends object-like type, if the type satisfies some restrictions:
Read more >Handbook - Interfaces - TypeScript
In TypeScript, interfaces fill the role of naming these types, and are a powerful way of defining contracts within your code as well...
Read more >Using an Interface as a Type (The Java™ Tutorials > Learning ...
When you define a new interface, you are defining a new reference data type. You can use interface names anywhere you can use...
Read more >Object Interfaces - Manual - PHP
Interfaces can be extended like classes using the extends operator. Note: The class implementing the interface must declare all methods in the interface...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As long as you assign the type a name it works, and it does the proper check already:
So IMO we should definitely support the anonymous/expression version of this for orthogonality/consistency
In principle it’s doable - we can detect when the resolved entity is a legal extends target