TypeScript/tests/baselines/reference/invalidTryStatements.types
Eli Barzilay ffa35d3272 Allow e: unknown in catch arguments
In addition, allow an explicit `any`; anything else throws an error.

Also adjust and reorganize existing tests.

Fixes #36775.
2020-06-10 18:24:20 -04:00

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
}