Skip to content

Commit b47f01a

Browse files
Add test for catch variable explicitly typed as 'any'.
1 parent 4c09bd3 commit b47f01a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/cases/compiler/useUnknownInCatchVariables01.ts

+12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ catch (e) {
1818
e.stack?.toUpperCase();
1919
}
2020
if (typeof e === "number") {
21+
e.toExponential();
2122
e++;
2223
}
24+
}
25+
26+
27+
try {
28+
// ...
29+
}
30+
catch (e: any) {
31+
// All are allowed.
32+
void e.toUpperCase();
33+
void e.toExponential();
34+
void e();
2335
}

0 commit comments

Comments
 (0)