File: inheritedOverloadedSpecializedSignatures.types

package info (click to toggle)
node-typescript 2.1.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 203,960 kB
  • sloc: sh: 11; makefile: 5
file content (146 lines) | stat: -rw-r--r-- 1,896 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
=== tests/cases/compiler/inheritedOverloadedSpecializedSignatures.ts ===
interface A {
>A : A

  (key:string):void;
>key : string
}

interface B extends A {
>B : B
>A : A

  (key:'foo'):string;
>key : "foo"
}

var b:B;
>b : B
>B : B

// Should not error
b('foo').charAt(0);
>b('foo').charAt(0) : string
>b('foo').charAt : (pos: number) => string
>b('foo') : string
>b : B
>'foo' : "foo"
>charAt : (pos: number) => string
>0 : 0

interface A {
>A : A

    (x: 'A1'): string;
>x : "A1"

    (x: string): void;
>x : string
}

interface B extends A {
>B : B
>A : A

    (x: 'B1'): number;
>x : "B1"
}

interface A {
>A : A

    (x: 'A2'): boolean;
>x : "A2"
}

interface B  {
>B : B

    (x: 'B2'): string[];
>x : "B2"
}

interface C1 extends B {
>C1 : C1
>B : B

	(x: 'C1'): number[];
>x : "C1"
}

interface C2 extends B {
>C2 : C2
>B : B

	(x: 'C2'): boolean[];
>x : "C2"
}

interface C extends C1, C2 {
>C : C
>C1 : C1
>C2 : C2

	(x: 'C'): string;
>x : "C"
}

var c: C;
>c : C
>C : C

// none of these lines should error
var x1: string[] = c('B2');
>x1 : string[]
>c('B2') : string[]
>c : C
>'B2' : "B2"

var x2: number = c('B1');
>x2 : number
>c('B1') : number
>c : C
>'B1' : "B1"

var x3: boolean = c('A2');
>x3 : boolean
>c('A2') : boolean
>c : C
>'A2' : "A2"

var x4: string = c('A1');
>x4 : string
>c('A1') : string
>c : C
>'A1' : "A1"

var x5: void = c('A0');
>x5 : void
>c('A0') : void
>c : C
>'A0' : "A0"

var x6: number[] = c('C1');
>x6 : number[]
>c('C1') : number[]
>c : C
>'C1' : "C1"

var x7: boolean[] = c('C2');
>x7 : boolean[]
>c('C2') : boolean[]
>c : C
>'C2' : "C2"

var x8: string = c('C');
>x8 : string
>c('C') : string
>c : C
>'C' : "C"

var x9: void = c('generic');
>x9 : void
>c('generic') : void
>c : C
>'generic' : "generic"