File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
tests/cases/conformance/controlFlow Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -126,3 +126,14 @@ declare class Wat {
126
126
get p2 ( ) : asserts this is string ;
127
127
set p2 ( x : asserts this is string) ;
128
128
}
129
+
130
+ function f20 ( x : unknown ) {
131
+ const assert = ( value : unknown ) : asserts value => { }
132
+ assert ( typeof x === "string" ) ; // Error
133
+ const a = [ assert ] ;
134
+ a [ 0 ] ( typeof x === "string" ) ; // Error
135
+ const t1 = new Test ( ) ;
136
+ t1 . assert ( typeof x === "string" ) ; // Error
137
+ const t2 : Test = new Test ( ) ;
138
+ t2 . assert ( typeof x === "string" ) ;
139
+ }
Original file line number Diff line number Diff line change @@ -157,6 +157,13 @@ function f42(x: number) {
157
157
x ; // Unreachable
158
158
}
159
159
160
+ function f43 ( ) {
161
+ const fail = ( ) : never => { throw new Error ( ) ; } ;
162
+ const f = [ fail ] ;
163
+ fail ( ) ; // Error
164
+ f [ 0 ] ( ) ; // Error
165
+ }
166
+
160
167
// Repro from #33582
161
168
162
169
export interface Component < T extends object = any > {
You can’t perform that action at this time.
0 commit comments