ffa35d3272
In addition, allow an explicit `any`; anything else throws an error. Also adjust and reorganize existing tests. Fixes #36775.
30 lines
713 B
Plaintext
30 lines
713 B
Plaintext
=== tests/cases/conformance/statements/tryStatements/invalidTryStatements.ts ===
|
|
function fn() {
|
|
>fn : () => void
|
|
|
|
catch(x) { } // error missing try
|
|
>x : any
|
|
|
|
finally { } // potential error; can be absorbed by the 'catch'
|
|
|
|
try { }; // error missing finally
|
|
}
|
|
|
|
function fn2() {
|
|
>fn2 : () => void
|
|
|
|
finally { } // error missing try
|
|
catch (x) { } // error missing try
|
|
>x : any
|
|
|
|
try { } finally { } // statement is here, so the 'catch' clause above doesn't absorb errors from the 'finally' clause below
|
|
|
|
finally { } // error missing try
|
|
|
|
catch (x) { } // error missing try
|
|
>x : any
|
|
|
|
try { } catch () { } // error missing catch binding
|
|
> : any
|
|
}
|