Enable type parameter lower-bound syntax
<!-- BUGS: Please use this template. --> <!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript --> <!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md --> **TypeScript Version:** 2.1.1 **Code** ```ts class Animal {} class Cat extends Animal {} class Kitten extends Cat{} function foo<A super Kitten>(a: A) { /* */ } ``` **Expected behavior:** The type parameter `A` has the type `Kitten` as lower-bound. **Actual behavior:** Compilation failure. The syntax is unsupported. **Discussion:** The upper-bound counterpart of the failed code works fine: ```ts class Animal {} class Cat extends Animal {} class Kitten extends Cat{} function foo<A extends Animal>(a: A) { /* */ } ``` People in issue [#13337](https://github.com/Microsoft/TypeScript/issues/13337) have suggested to use ```ts function foo <X extends Y, Y>(y: Y) { /* */ } ``` to lower-bound `Y` with `X`. But this does not cover the case where `X` is an actual type (instead of a type parameter).
Posted by jyuhuan on Mar 7, 2017, 8:12 PM
Tags
Related issues
- Add 65536 size support for maps
- TypeScript 7.1 Iteration Plan
- nvim-treeconfig: upstream nvim-treesitter
- Add the "action" and "method" attributes to <button>
- [FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
- > We were imposed GitHub for so many exercises!
Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments
support (Software)
Add 65536 size support for maps
TypeScript 7.1 Iteration Plan
nvim-treeconfig: upstream nvim-treesitter
Add the "action" and "method" attributes to <button>
[FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
> We were imposed GitHub for so many exercises!
Add support for Visual Studio 2026 Integration
Support for Helm v4
Enable type parameter lower-bound syntax
<!-- BUGS: Please use this template. --> <!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript --> <!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md --> **TypeScript Version:** 2.1.1 **Code** ```ts class Animal {} class Cat extends Animal {} class Kitten extends Cat{} function foo<A super Kitten>(a: A) { /* */ } ``` **Expected behavior:** The type parameter `A` has the type `Kitten` as lower-bound. **Actual behavior:** Compilation failure. The syntax is unsupported. **Discussion:** The upper-bound counterpart of the failed code works fine: ```ts class Animal {} class Cat extends Animal {} class Kitten extends Cat{} function foo<A extends Animal>(a: A) { /* */ } ``` People in issue [#13337](https://github.com/Microsoft/TypeScript/issues/13337) have suggested to use ```ts function foo <X extends Y, Y>(y: Y) { /* */ } ``` to lower-bound `Y` with `X`. But this does not cover the case where `X` is an actual type (instead of a type parameter).
Comments (0)
No comments yet. Start the discussion.