File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Fixes #14860
2+ // note: repros with `while (0);` too
3+ // but it's less inscrutable and more obvious to put it *inside* the loop
4+ while ( 0 ) {
5+ class A {
6+ methodA ( ) {
7+ this ; //note: a this reference of some kind is required to trigger the bug
8+ }
9+ }
10+
11+ class B {
12+ methodB ( ) {
13+ this . methodA ; // error
14+ this . methodB ; // ok
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change 11// @strictNullChecks : true
22
3+ // Fixes #10501, possibly null 'x'
34function f ( ) {
45 const x : string | null = < any > { } ;
56 if ( x !== null ) {
67 return {
7- bar ( ) { return x . length ; } // Error: possibly null x
8+ bar ( ) { return x . length ; } // ok
89 } ;
910 }
1011}
@@ -13,7 +14,7 @@ function f2() {
1314 const x : string | null = < any > { } ;
1415 if ( x !== null ) {
1516 return class {
16- bar ( ) { return x . length ; } // Error: possibly null x
17+ bar ( ) { return x . length ; } // ok
1718 } ;
1819 }
19- }
20+ }
You can’t perform that action at this time.
0 commit comments