File: inheritanceOfGenericConstructorMethod1.types

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 648 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
=== tests/cases/compiler/inheritanceOfGenericConstructorMethod1.ts ===
class A<T> { }
>A : A<T>
>T : T

class B<T> extends A<T> {}
>B : B<T>
>T : T
>A : A<T>
>T : T

var a = new A<Date>();
>a : A<Date>
>new A<Date>() : A<Date>
>A : typeof A
>Date : Date

var b1 = new B(); // no error
>b1 : B<{}>
>new B() : B<{}>
>B : typeof B

var b2: B<Date> = new B<Date>(); // no error
>b2 : B<Date>
>B : B<T>
>Date : Date
>new B<Date>() : B<Date>
>B : typeof B
>Date : Date

var b3 = new B<Date>(); // error, could not select overload for 'new' expression
>b3 : B<Date>
>new B<Date>() : B<Date>
>B : typeof B
>Date : Date