File: thisTypeInFunctionsNegative.errors.txt

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 (445 lines) | stat: -rw-r--r-- 31,030 bytes parent folder | download
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(16,15): error TS2339: Property 'n' does not exist on type 'void'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(39,21): error TS2339: Property 'a' does not exist on type 'void'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(49,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type '{ a: number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(51,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(56,21): error TS2339: Property 'notFound' does not exist on type '{ y: number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(59,21): error TS2339: Property 'notSpecified' does not exist on type 'void'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(61,79): error TS2322: Type '{ y: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: number; f: (this: { y: number; }, x: number) => number; }'.
  Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: number; f: (this: { y: number; }, x: number) => number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(62,97): error TS2322: Type '{ y: string; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: string; f: (this: { y: number; }, x: number) => number; }'.
  Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(63,110): error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
  Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(65,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(66,6): error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'.
  Types of property 'y' are incompatible.
    Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(69,1): error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'.
  Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' but required in type '{ y: number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(72,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(73,13): error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(75,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,16): error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(79,16): error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,1): error TS2554: Expected 1 arguments, but got 0.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,20): error TS2345: Argument of type '"wrong type 3"' is not assignable to parameter of type 'number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,1): error TS2554: Expected 1 arguments, but got 2.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(86,5): error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'.
  The 'this' types of each signature are incompatible.
    Type 'void' is not assignable to type '{ y: number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(107,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Type 'C' is missing the following properties from type 'D': x, explicitD
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(108,1): error TS2322: Type '(this: { x: number; }, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Property 'x' is missing in type '{ n: number; }' but required in type '{ x: number; }'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(110,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Type 'C' is not assignable to type 'D'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(111,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Type 'C' is not assignable to type 'D'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(112,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Type 'C' is not assignable to type 'D'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(113,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Type 'C' is not assignable to type 'D'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(114,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Type '{ n: number; }' is missing the following properties from type 'D': x, explicitThis, explicitD
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(115,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(116,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Type 'void' is not assignable to type 'D'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(117,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
  The 'this' types of each signature are incompatible.
    Type 'void' is not assignable to type 'D'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(125,69): error TS2339: Property 'x' does not exist on type 'typeof Base1'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(145,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
  The 'this' types of each signature are incompatible.
    Property 'y' is missing in type 'Base1' but required in type 'Base2'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(146,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
  The 'this' types of each signature are incompatible.
    Type 'Base1' is not assignable to type 'Base2'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(148,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(154,16): error TS2679: A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(158,17): error TS2681: A constructor cannot have a 'this' parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(162,9): error TS2681: A constructor cannot have a 'this' parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(164,31): error TS2681: A constructor cannot have a 'this' parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(165,30): error TS2680: A 'this' parameter must be the first parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,26): error TS1003: Identifier expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,26): error TS2680: A 'this' parameter must be the first parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,23): error TS1003: Identifier expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,23): error TS2680: A 'this' parameter must be the first parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,23): error TS1005: ',' expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,28): error TS1003: Identifier expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,28): error TS2680: A 'this' parameter must be the first parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,30): error TS1005: ',' expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,32): error TS1003: Identifier expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,37): error TS1005: ',' expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,38): error TS1109: Expression expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,39): error TS1005: ';' expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,40): error TS1128: Declaration or statement expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,42): error TS2693: 'number' only refers to a type, but is being used as a value here.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,49): error TS1005: ';' expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,23): error TS2730: An arrow function cannot have a 'this' parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(176,16): error TS2730: An arrow function cannot have a 'this' parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(177,19): error TS2730: An arrow function cannot have a 'this' parameter.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(178,22): error TS2730: An arrow function cannot have a 'this' parameter.


==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (65 errors) ====
    class C {
        n: number;
        explicitThis(this: this, m: number): number {
            return this.n + m;
        }
        implicitThis(m: number): number {
            return this.n + m;
        }
        explicitC(this: C, m: number): number {
            return this.n + m;
        }
        explicitProperty(this: {n: number}, m: number): number {
            return this.n + m;
        }
        explicitVoid(this: void, m: number): number {
    		return this.n + m; // 'n' doesn't exist on type 'void'.
    		            ~
!!! error TS2339: Property 'n' does not exist on type 'void'.
        }
    }
    class D {
    	x: number;
    	explicitThis(this: this, m: number): number {
    		return this.x + m;
    	}
    	explicitD(this: D, m: number): number {
    		return this.x + m;
    	}
    }
    interface I {
        a: number;
        explicitVoid1(this: void): number;
        explicitVoid2(this: void): number;
        explicitStructural(this: {a: number}): number;
        explicitInterface(this: I): number;
        explicitThis(this: this): number; // TODO: Allow `this` types for interfaces
    }
    let impl: I = {
        a: 12,
        explicitVoid1() {
            return this.a; // error, no 'a' in 'void'
                        ~
!!! error TS2339: Property 'a' does not exist on type 'void'.
        },
        explicitVoid2: () => this.a, // ok, `this:any` because it refers to an outer object
        explicitStructural: () => 12,
        explicitInterface: () => 12,
        explicitThis() {
            return this.a;
        },
    }
    let implExplicitStructural = impl.explicitStructural;
    implExplicitStructural(); // error, no 'a' in 'void'
    ~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type '{ a: number; }'.
    let implExplicitInterface = impl.explicitInterface;
    implExplicitInterface(); // error, no 'a' in 'void' 
    ~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'.
    function explicitStructural(this: { y: number }, x: number): number {
        return x + this.y;
    }
    function propertyName(this: { y: number }, x: number): number {
        return x + this.notFound;
                        ~~~~~~~~
!!! error TS2339: Property 'notFound' does not exist on type '{ y: number; }'.
    }
    function voidThisSpecified(this: void, x: number): number {
        return x + this.notSpecified;
                        ~~~~~~~~~~~~
!!! error TS2339: Property 'notSpecified' does not exist on type 'void'.
    }
    let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural };
                                                                                  ~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ y: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: number; f: (this: { y: number; }, x: number) => number; }'.
!!! error TS2322:   Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: number; f: (this: { y: number; }, x: number) => number; }'.
    let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural };
                                                                                                    ~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ y: string; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: string; f: (this: { y: number; }, x: number) => number; }'.
!!! error TS2322:   Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'.
    let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural };
                                                                                                                 ~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
!!! error TS2322:   Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
    
    ok.f(); // not enough arguments
    ~~~~~~
!!! error TS2554: Expected 1 arguments, but got 0.
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:61:46: An argument for 'x' was not provided.
    ok.f('wrong type');
         ~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'.
    ok.f(13, 'too many arguments');
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
    wrongPropertyType.f(13);
    ~~~~~~~~~~~~~~~~~
!!! error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'.
!!! error TS2684:   Types of property 'y' are incompatible.
!!! error TS2684:     Type 'string' is not assignable to type 'number'.
    wrongPropertyName.f(13);
    ~~~~~~~~~~~~~~~~~
!!! error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'.
!!! error TS2684:   Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' but required in type '{ y: number; }'.
!!! related TS2728 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:63:56: 'y' is declared here.
    
    let c = new C();
    c.explicitC(); // not enough arguments
    ~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 0.
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:9:24: An argument for 'm' was not provided.
    c.explicitC('wrong type');
                ~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type"' is not assignable to parameter of type 'number'.
    c.explicitC(13, 'too many arguments');
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
    c.explicitThis(); // not enough arguments
    ~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 0.
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:3:30: An argument for 'm' was not provided.
    c.explicitThis('wrong type 2');
                   ~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'.
    c.explicitThis(14, 'too many arguments 2');
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
    c.implicitThis(); // not enough arguments
    ~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 0.
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:6:18: An argument for 'm' was not provided.
    c.implicitThis('wrong type 2');
                   ~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type 2"' is not assignable to parameter of type 'number'.
    c.implicitThis(14, 'too many arguments 2');
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
    c.explicitProperty(); // not enough arguments
    ~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 0.
!!! related TS6210 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:12:41: An argument for 'm' was not provided.
    c.explicitProperty('wrong type 3');
                       ~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"wrong type 3"' is not assignable to parameter of type 'number'.
    c.explicitProperty(15, 'too many arguments 3');
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 1 arguments, but got 2.
    
    // oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void.
    let specifiedToVoid: (this: void, x: number) => number = explicitStructural;
        ~~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'void' is not assignable to type '{ y: number; }'.
    
    let reconstructed: { 
        n: number,
        explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type.
        explicitC(this: C, m: number): number,
        explicitProperty: (this: {n : number}, m: number) => number,
        explicitVoid(this: void, m: number): number,
    } = { 
        n: 12,
        explicitThis: c.explicitThis,
        explicitC: c.explicitC,
        explicitProperty: c.explicitProperty,
        explicitVoid: c.explicitVoid
    };;
    
    // lambdas have this: void for assignability purposes (and this unbound (free) for body checking)
    let d = new D();
    let explicitXProperty: (this: { x: number }, m: number) => number;
    
    // from differing object types
    c.explicitC = function(this: D, m: number) { return this.x + m };
    ~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'C' is missing the following properties from type 'D': x, explicitD
    c.explicitProperty = explicitXProperty;
    ~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: { x: number; }, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Property 'x' is missing in type '{ n: number; }' but required in type '{ x: number; }'.
!!! related TS2728 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:104:33: 'x' is declared here.
    
    c.explicitC = d.explicitD;
    ~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'C' is not assignable to type 'D'.
    c.explicitC = d.explicitThis;
    ~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'C' is not assignable to type 'D'.
    c.explicitThis = d.explicitD;
    ~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'C' is not assignable to type 'D'.
    c.explicitThis = d.explicitThis;
    ~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'C' is not assignable to type 'D'.
    c.explicitProperty = d.explicitD;
    ~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type '{ n: number; }' is missing the following properties from type 'D': x, explicitThis, explicitD
    c.explicitThis = d.explicitThis;
    ~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
    c.explicitVoid = d.explicitD;
    ~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'void' is not assignable to type 'D'.
    c.explicitVoid = d.explicitThis;
    ~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'void' is not assignable to type 'D'.
    
    /// class-based polymorphic assignability (with inheritance!) ///
    
    class Base1 {
        x: number
        public polymorphic(this: this): number { return this.x; }
        explicit(this: Base1): number { return this.x; }
        static explicitStatic(this: typeof Base1): number { return this.x; }
                                                                        ~
!!! error TS2339: Property 'x' does not exist on type 'typeof Base1'.
    }
    class Derived1 extends Base1 {
        y: number
    }
    class Base2 {
        y: number
        polymorphic(this: this): number { return this.y; }
        explicit(this: Base1): number { return this.x; }
    }
    class Derived2 extends Base2 {
        x: number
    }
    
    
    let b1 = new Base1();
    let d1 = new Derived1();
    let b2 = new Base2();
    let d2 = new Derived2();
    
    b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x }
    ~~~~~~~~~~~~~~
!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Property 'y' is missing in type 'Base1' but required in type 'Base2'.
!!! related TS2728 tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts:131:5: 'y' is declared here.
    b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x }
    ~~~~~~~~~~~
!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
!!! error TS2322:   The 'this' types of each signature are incompatible.
!!! error TS2322:     Type 'Base1' is not assignable to type 'Base2'.
    
    d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x }
    ~~~~~~~~~~~
!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
    
    ////// use this-type for construction with new ////
    function VoidThis(this: void) {
    
    }
    let voidThis = new VoidThis();
                   ~~~~~~~~~~~~~~
!!! error TS2679: A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.
    
    ///// syntax-ish errors /////
    class ThisConstructor {
        constructor(this: ThisConstructor, private n: number) {
                    ~~~~~~~~~~~~~~~~~~~~~
!!! error TS2681: A constructor cannot have a 'this' parameter.
        }
    }
    interface ThisConstructorInterface {
        new(this: ThisConstructor, n: number);
            ~~~~~~~~~~~~~~~~~~~~~
!!! error TS2681: A constructor cannot have a 'this' parameter.
    }
    var thisConstructorType: new (this: number) => number;
                                  ~~~~~~~~~~~~
!!! error TS2681: A constructor cannot have a 'this' parameter.
    function notFirst(a: number, this: C): number { return this.n; }
                                 ~~~~~~~
!!! error TS2680: A 'this' parameter must be the first parameter.
    
    ///// parse errors /////
    function modifiers(async this: C): number { return this.n; }
                             ~~~~
!!! error TS1003: Identifier expected.
                             ~~~~~~~
!!! error TS2680: A 'this' parameter must be the first parameter.
    function restParam(...this: C): number { return this.n; }
                          ~~~~
!!! error TS1003: Identifier expected.
                          ~~~~~~~
!!! error TS2680: A 'this' parameter must be the first parameter.
    function optional(this?: C): number { return this.n; }
                          ~
!!! error TS1005: ',' expected.
    function decorated(@deco() this: C): number { return this.n; }
                               ~~~~
!!! error TS1003: Identifier expected.
                               ~~~~~~~
!!! error TS2680: A 'this' parameter must be the first parameter.
    function initializer(this: C = new C()): number { return this.n; }
                                 ~
!!! error TS1005: ',' expected.
                                   ~~~
!!! error TS1003: Identifier expected.
                                        ~
!!! error TS1005: ',' expected.
                                         ~
!!! error TS1109: Expression expected.
                                          ~
!!! error TS1005: ';' expected.
                                           ~
!!! error TS1128: Declaration or statement expected.
                                             ~~~~~~
!!! error TS2693: 'number' only refers to a type, but is being used as a value here.
                                                    ~
!!! error TS1005: ';' expected.
    
    // can't name parameters 'this' in a lambda.
    c.explicitProperty = (this, m) => m + this.n;
                          ~~~~
!!! error TS2730: An arrow function cannot have a 'this' parameter.
    const f2 = <T>(this: {n: number}, m: number) => m + this.n;
                   ~~~~~~~~~~~~~~~~~
!!! error TS2730: An arrow function cannot have a 'this' parameter.
    const f3 = async (this: {n: number}, m: number) => m + this.n;
                      ~~~~~~~~~~~~~~~~~
!!! error TS2730: An arrow function cannot have a 'this' parameter.
    const f4 = async <T>(this: {n: number}, m: number) => m + this.n;
                         ~~~~~~~~~~~~~~~~~
!!! error TS2730: An arrow function cannot have a 'this' parameter.