@@ -196,6 +196,68 @@ function example1(things: Thing[]) {
196
196
thing . good ;
197
197
}
198
198
}
199
+
200
+ class TestPropertyDeclaration1 {
201
+ assert = ( value : unknown ) : asserts value => { } ;
202
+ other ( x : unknown ) {
203
+ this . assert ( x ) ; // error
204
+ x ;
205
+ }
206
+ }
207
+
208
+ class TestPropertyDeclaration2 {
209
+ assert : ( v : unknown ) = > asserts v = ( value ) => { } ;
210
+ other ( x : unknown ) {
211
+ this . assert ( x ) ; // ok
212
+ x ;
213
+ }
214
+ }
215
+
216
+ declare class ParentInheritedPropertyDeclaration {
217
+ assert : ( value : unknown ) = > asserts value ;
218
+ }
219
+ class ChildInheritedPropertyDeclaration extends ParentInheritedPropertyDeclaration {
220
+ other ( x : unknown ) {
221
+ this . assert ( x ) ; // ok
222
+ x ;
223
+ }
224
+ }
225
+
226
+ interface TestPropertySignature {
227
+ assert : ( value : unknown ) = > asserts value ;
228
+ }
229
+ function testPropertySignature (
230
+ x : TestPropertySignature ,
231
+ y : unknown ,
232
+ ) {
233
+ x . assert ( y ) ; // ok
234
+ x ;
235
+ }
236
+ function testFunctionThisParameter1 (
237
+ this : TestPropertySignature ,
238
+ x : unknown ,
239
+ ) {
240
+ this . assert ( x ) ; // ok
241
+ x ;
242
+ }
243
+
244
+ interface TestMethodSignature {
245
+ assert ( value : unknown ) : asserts value ;
246
+ }
247
+ function testMethodSignature (
248
+ x : TestMethodSignature ,
249
+ y : unknown ,
250
+ ) {
251
+ x . assert ( y ) ; // ok
252
+ x ;
253
+ }
254
+ function testFunctionThisParameter2 (
255
+ this : TestMethodSignature ,
256
+ x : unknown ,
257
+ ) {
258
+ this . assert ( x ) ; // ok
259
+ x ;
260
+ }
199
261
200
262
201
263
//// [assertionTypePredicates1.js]
@@ -386,6 +448,53 @@ function example1(things) {
386
448
thing . good ;
387
449
}
388
450
}
451
+ var TestPropertyDeclaration1 = /** @class */ ( function ( ) {
452
+ function TestPropertyDeclaration1 ( ) {
453
+ this . assert = function ( value ) { } ;
454
+ }
455
+ TestPropertyDeclaration1 . prototype . other = function ( x ) {
456
+ this . assert ( x ) ; // error
457
+ x ;
458
+ } ;
459
+ return TestPropertyDeclaration1 ;
460
+ } ( ) ) ;
461
+ var TestPropertyDeclaration2 = /** @class */ ( function ( ) {
462
+ function TestPropertyDeclaration2 ( ) {
463
+ this . assert = function ( value ) { } ;
464
+ }
465
+ TestPropertyDeclaration2 . prototype . other = function ( x ) {
466
+ this . assert ( x ) ; // ok
467
+ x ;
468
+ } ;
469
+ return TestPropertyDeclaration2 ;
470
+ } ( ) ) ;
471
+ var ChildInheritedPropertyDeclaration = /** @class */ ( function ( _super ) {
472
+ __extends ( ChildInheritedPropertyDeclaration , _super ) ;
473
+ function ChildInheritedPropertyDeclaration ( ) {
474
+ return _super !== null && _super . apply ( this , arguments ) || this ;
475
+ }
476
+ ChildInheritedPropertyDeclaration . prototype . other = function ( x ) {
477
+ this . assert ( x ) ; // ok
478
+ x ;
479
+ } ;
480
+ return ChildInheritedPropertyDeclaration ;
481
+ } ( ParentInheritedPropertyDeclaration ) ) ;
482
+ function testPropertySignature ( x , y ) {
483
+ x . assert ( y ) ; // ok
484
+ x ;
485
+ }
486
+ function testFunctionThisParameter1 ( x ) {
487
+ this . assert ( x ) ; // ok
488
+ x ;
489
+ }
490
+ function testMethodSignature ( x , y ) {
491
+ x . assert ( y ) ; // ok
492
+ x ;
493
+ }
494
+ function testFunctionThisParameter2 ( x ) {
495
+ this . assert ( x ) ; // ok
496
+ x ;
497
+ }
389
498
390
499
391
500
//// [assertionTypePredicates1.d.ts]
@@ -438,3 +547,27 @@ interface GoodThing {
438
547
good : true ;
439
548
}
440
549
declare function example1 ( things : Thing [ ] ) : void ;
550
+ declare class TestPropertyDeclaration1 {
551
+ assert : ( value : unknown ) = > asserts value ;
552
+ other ( x : unknown ) : void ;
553
+ }
554
+ declare class TestPropertyDeclaration2 {
555
+ assert : ( v : unknown ) = > asserts v ;
556
+ other ( x : unknown ) : void ;
557
+ }
558
+ declare class ParentInheritedPropertyDeclaration {
559
+ assert : ( value : unknown ) = > asserts value ;
560
+ }
561
+ declare class ChildInheritedPropertyDeclaration extends ParentInheritedPropertyDeclaration {
562
+ other ( x : unknown ) : void ;
563
+ }
564
+ interface TestPropertySignature {
565
+ assert : ( value : unknown ) = > asserts value ;
566
+ }
567
+ declare function testPropertySignature ( x : TestPropertySignature , y : unknown ) : void ;
568
+ declare function testFunctionThisParameter1 ( this : TestPropertySignature , x : unknown ) : void ;
569
+ interface TestMethodSignature {
570
+ assert ( value : unknown ) : asserts value ;
571
+ }
572
+ declare function testMethodSignature ( x : TestMethodSignature , y : unknown ) : void ;
573
+ declare function testFunctionThisParameter2 ( this : TestMethodSignature , x : unknown ) : void ;
0 commit comments