From b47f01abb03046e229c3c3f787dda187f7d1b33a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 2 Dec 2020 13:16:39 -0800 Subject: [PATCH] Add test for catch variable explicitly typed as 'any'. --- tests/cases/compiler/useUnknownInCatchVariables01.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/cases/compiler/useUnknownInCatchVariables01.ts b/tests/cases/compiler/useUnknownInCatchVariables01.ts index c9633c97e4f..ca9bdda4acb 100644 --- a/tests/cases/compiler/useUnknownInCatchVariables01.ts +++ b/tests/cases/compiler/useUnknownInCatchVariables01.ts @@ -18,6 +18,18 @@ catch (e) { e.stack?.toUpperCase(); } if (typeof e === "number") { + e.toExponential(); e++; } +} + + +try { + // ... +} +catch (e: any) { + // All are allowed. + void e.toUpperCase(); + void e.toExponential(); + void e(); } \ No newline at end of file