-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 2.1.1
Code
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:
class Animal {}
class Cat extends Animal {}
class Kitten extends Cat{}
function foo<A extends Animal>(a: A) { /* */ }People in issue #13337 have suggested to use
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).
jklmli, btipling, gkdn, zpdDG4gta8XKpMCd, mikejhill and 184 moreqwertiedevurandom, neongreen, mkosir, john-rodewald, yannxaver and 3 more
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript