File: contextualTypingOfOptionalMembers.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (235 lines) | stat: -rw-r--r-- 8,426 bytes parent folder | download | duplicates (5)
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
=== tests/cases/compiler/index.tsx ===
interface ActionsObject<State> {
>ActionsObject : Symbol(ActionsObject, Decl(index.tsx, 0, 0))
>State : Symbol(State, Decl(index.tsx, 0, 24))

    [prop: string]: (state: State) => State;
>prop : Symbol(prop, Decl(index.tsx, 1, 5))
>state : Symbol(state, Decl(index.tsx, 1, 21))
>State : Symbol(State, Decl(index.tsx, 0, 24))
>State : Symbol(State, Decl(index.tsx, 0, 24))
}

interface Options<State, Actions> {
>Options : Symbol(Options, Decl(index.tsx, 2, 1))
>State : Symbol(State, Decl(index.tsx, 4, 18))
>Actions : Symbol(Actions, Decl(index.tsx, 4, 24))

    state?: State;
>state : Symbol(Options.state, Decl(index.tsx, 4, 35))
>State : Symbol(State, Decl(index.tsx, 4, 18))

    view?: (state: State, actions: Actions) => any;
>view : Symbol(Options.view, Decl(index.tsx, 5, 18))
>state : Symbol(state, Decl(index.tsx, 6, 12))
>State : Symbol(State, Decl(index.tsx, 4, 18))
>actions : Symbol(actions, Decl(index.tsx, 6, 25))
>Actions : Symbol(Actions, Decl(index.tsx, 4, 24))

    actions: string | Actions;
>actions : Symbol(Options.actions, Decl(index.tsx, 6, 51))
>Actions : Symbol(Actions, Decl(index.tsx, 4, 24))
}

declare function app<State, Actions extends ActionsObject<State>>(obj: Options<State, Actions>): void;
>app : Symbol(app, Decl(index.tsx, 8, 1))
>State : Symbol(State, Decl(index.tsx, 10, 21))
>Actions : Symbol(Actions, Decl(index.tsx, 10, 27))
>ActionsObject : Symbol(ActionsObject, Decl(index.tsx, 0, 0))
>State : Symbol(State, Decl(index.tsx, 10, 21))
>obj : Symbol(obj, Decl(index.tsx, 10, 66))
>Options : Symbol(Options, Decl(index.tsx, 2, 1))
>State : Symbol(State, Decl(index.tsx, 10, 21))
>Actions : Symbol(Actions, Decl(index.tsx, 10, 27))

app({
>app : Symbol(app, Decl(index.tsx, 8, 1))

    state: 100,
>state : Symbol(state, Decl(index.tsx, 12, 5))

    actions: {
>actions : Symbol(actions, Decl(index.tsx, 13, 15))

        foo: s => s // Should be typed number => number
>foo : Symbol(foo, Decl(index.tsx, 14, 14))
>s : Symbol(s, Decl(index.tsx, 15, 12))
>s : Symbol(s, Decl(index.tsx, 15, 12))

    },
    view: (s, a) => undefined as any,
>view : Symbol(view, Decl(index.tsx, 16, 6))
>s : Symbol(s, Decl(index.tsx, 17, 11))
>a : Symbol(a, Decl(index.tsx, 17, 13))
>undefined : Symbol(undefined)

});


interface Bar {
>Bar : Symbol(Bar, Decl(index.tsx, 18, 3))

    bar: (a: number) => void;
>bar : Symbol(Bar.bar, Decl(index.tsx, 21, 15))
>a : Symbol(a, Decl(index.tsx, 22, 10))
}

declare function foo<T extends Bar>(x: string | T): T;
>foo : Symbol(foo, Decl(index.tsx, 23, 1))
>T : Symbol(T, Decl(index.tsx, 25, 21))
>Bar : Symbol(Bar, Decl(index.tsx, 18, 3))
>x : Symbol(x, Decl(index.tsx, 25, 36))
>T : Symbol(T, Decl(index.tsx, 25, 21))
>T : Symbol(T, Decl(index.tsx, 25, 21))

const y = foo({
>y : Symbol(y, Decl(index.tsx, 27, 5))
>foo : Symbol(foo, Decl(index.tsx, 23, 1))

    bar(x) { // Should be typed number => void
>bar : Symbol(bar, Decl(index.tsx, 27, 15))
>x : Symbol(x, Decl(index.tsx, 28, 8))
    }
});

interface Options2<State, Actions> {
>Options2 : Symbol(Options2, Decl(index.tsx, 30, 3))
>State : Symbol(State, Decl(index.tsx, 32, 19))
>Actions : Symbol(Actions, Decl(index.tsx, 32, 25))

    state?: State;
>state : Symbol(Options2.state, Decl(index.tsx, 32, 36))
>State : Symbol(State, Decl(index.tsx, 32, 19))

    view?: (state: State, actions: Actions) => any;
>view : Symbol(Options2.view, Decl(index.tsx, 33, 18))
>state : Symbol(state, Decl(index.tsx, 34, 12))
>State : Symbol(State, Decl(index.tsx, 32, 19))
>actions : Symbol(actions, Decl(index.tsx, 34, 25))
>Actions : Symbol(Actions, Decl(index.tsx, 32, 25))

    actions?: Actions;
>actions : Symbol(Options2.actions, Decl(index.tsx, 34, 51))
>Actions : Symbol(Actions, Decl(index.tsx, 32, 25))
}

declare function app2<State, Actions extends ActionsObject<State>>(obj: Options2<State, Actions>): void;
>app2 : Symbol(app2, Decl(index.tsx, 36, 1))
>State : Symbol(State, Decl(index.tsx, 38, 22))
>Actions : Symbol(Actions, Decl(index.tsx, 38, 28))
>ActionsObject : Symbol(ActionsObject, Decl(index.tsx, 0, 0))
>State : Symbol(State, Decl(index.tsx, 38, 22))
>obj : Symbol(obj, Decl(index.tsx, 38, 67))
>Options2 : Symbol(Options2, Decl(index.tsx, 30, 3))
>State : Symbol(State, Decl(index.tsx, 38, 22))
>Actions : Symbol(Actions, Decl(index.tsx, 38, 28))

app2({
>app2 : Symbol(app2, Decl(index.tsx, 36, 1))

    state: 100,
>state : Symbol(state, Decl(index.tsx, 40, 6))

    actions: {
>actions : Symbol(actions, Decl(index.tsx, 41, 15))

        foo: s => s // Should be typed number => number
>foo : Symbol(foo, Decl(index.tsx, 42, 14))
>s : Symbol(s, Decl(index.tsx, 43, 12))
>s : Symbol(s, Decl(index.tsx, 43, 12))

    },
    view: (s, a) => undefined as any,
>view : Symbol(view, Decl(index.tsx, 44, 6))
>s : Symbol(s, Decl(index.tsx, 45, 11))
>a : Symbol(a, Decl(index.tsx, 45, 13))
>undefined : Symbol(undefined)

});


type ActionsArray<State> = ((state: State) => State)[];
>ActionsArray : Symbol(ActionsArray, Decl(index.tsx, 46, 3))
>State : Symbol(State, Decl(index.tsx, 49, 18))
>state : Symbol(state, Decl(index.tsx, 49, 29))
>State : Symbol(State, Decl(index.tsx, 49, 18))
>State : Symbol(State, Decl(index.tsx, 49, 18))

declare function app3<State, Actions extends ActionsArray<State>>(obj: Options<State, Actions>): void;
>app3 : Symbol(app3, Decl(index.tsx, 49, 55))
>State : Symbol(State, Decl(index.tsx, 51, 22))
>Actions : Symbol(Actions, Decl(index.tsx, 51, 28))
>ActionsArray : Symbol(ActionsArray, Decl(index.tsx, 46, 3))
>State : Symbol(State, Decl(index.tsx, 51, 22))
>obj : Symbol(obj, Decl(index.tsx, 51, 66))
>Options : Symbol(Options, Decl(index.tsx, 2, 1))
>State : Symbol(State, Decl(index.tsx, 51, 22))
>Actions : Symbol(Actions, Decl(index.tsx, 51, 28))

app3({
>app3 : Symbol(app3, Decl(index.tsx, 49, 55))

    state: 100,
>state : Symbol(state, Decl(index.tsx, 53, 6))

    actions: [
>actions : Symbol(actions, Decl(index.tsx, 54, 15))

        s => s // Should be typed number => number
>s : Symbol(s, Decl(index.tsx, 55, 14))
>s : Symbol(s, Decl(index.tsx, 55, 14))

    ],
    view: (s, a) => undefined as any,
>view : Symbol(view, Decl(index.tsx, 57, 6))
>s : Symbol(s, Decl(index.tsx, 58, 11))
>a : Symbol(a, Decl(index.tsx, 58, 13))
>undefined : Symbol(undefined)

});

namespace JSX {
>JSX : Symbol(JSX, Decl(index.tsx, 59, 3))

    export interface Element {}
>Element : Symbol(Element, Decl(index.tsx, 61, 15))

    export interface IntrinsicElements {}
>IntrinsicElements : Symbol(IntrinsicElements, Decl(index.tsx, 62, 31))
}

interface ActionsObjectOr<State> {
>ActionsObjectOr : Symbol(ActionsObjectOr, Decl(index.tsx, 64, 1))
>State : Symbol(State, Decl(index.tsx, 66, 26))

    [prop: string]: ((state: State) => State) | State;
>prop : Symbol(prop, Decl(index.tsx, 67, 5))
>state : Symbol(state, Decl(index.tsx, 67, 22))
>State : Symbol(State, Decl(index.tsx, 66, 26))
>State : Symbol(State, Decl(index.tsx, 66, 26))
>State : Symbol(State, Decl(index.tsx, 66, 26))
}

declare function App4<State, Actions extends ActionsObjectOr<State>>(props: Options<State, Actions>["actions"] & { state: State }): JSX.Element;
>App4 : Symbol(App4, Decl(index.tsx, 68, 1))
>State : Symbol(State, Decl(index.tsx, 70, 22))
>Actions : Symbol(Actions, Decl(index.tsx, 70, 28))
>ActionsObjectOr : Symbol(ActionsObjectOr, Decl(index.tsx, 64, 1))
>State : Symbol(State, Decl(index.tsx, 70, 22))
>props : Symbol(props, Decl(index.tsx, 70, 69))
>Options : Symbol(Options, Decl(index.tsx, 2, 1))
>State : Symbol(State, Decl(index.tsx, 70, 22))
>Actions : Symbol(Actions, Decl(index.tsx, 70, 28))
>state : Symbol(state, Decl(index.tsx, 70, 114))
>State : Symbol(State, Decl(index.tsx, 70, 22))
>JSX : Symbol(JSX, Decl(index.tsx, 59, 3))
>Element : Symbol(JSX.Element, Decl(index.tsx, 61, 15))

const a = <App4 state={100} foo={s => s} />; // TODO: should be number => number, but JSX resolution is missing an inferential pass
>a : Symbol(a, Decl(index.tsx, 72, 5))
>App4 : Symbol(App4, Decl(index.tsx, 68, 1))
>state : Symbol(state, Decl(index.tsx, 72, 15))
>foo : Symbol(foo, Decl(index.tsx, 72, 27))
>s : Symbol(s, Decl(index.tsx, 72, 33))
>s : Symbol(s, Decl(index.tsx, 72, 33))