TypeScript Version: 2.1.1
Code
classAnimal{}classCatextendsAnimal{}classKittenextendsCat{}functionfoo<AsuperKitten>(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:
classAnimal{}classCatextendsAnimal{}classKittenextendsCat{}functionfoo<AextendsAnimal>(a: A){/* */}People in issue #13337 have suggested to use
functionfoo<XextendsY,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).
TypeScript Version: 2.1.1
Code
Expected behavior:
The type parameter
Ahas the typeKittenas lower-bound.Actual behavior:
Compilation failure. The syntax is unsupported.
Discussion:
The upper-bound counterpart of the failed code works fine:
People in issue #13337 have suggested to use
to lower-bound
YwithX. But this does not cover the case whereXis an actual type (instead of a type parameter).