Open
Description
in Deno 2 we enabled useUnknownInCatchVariables by default. Previously the caught value would be any
, now it is unknown
.
try {} catch (error) {
console.log(error.message);
}
with Deno 1.x:
% deno --version
deno 1.44.0 (release, aarch64-apple-darwin)
v8 12.6.228.3
typescript 5.4.5
% deno check index.ts
Check file:///Users/eduardoboucas/Sites/tests/deno-20-test/index.ts
with Deno 2.x:
% deno --version
deno 2.0.6 (stable, release, aarch64-apple-darwin)
v8 12.9.202.13-rusty
typescript 5.6.2
% deno check index.ts
Check file:///Users/eduardoboucas/Sites/tests/deno-20-test/index.ts
error: TS18046 [ERROR]: 'error' is of type 'unknown'.
console.log(error.message);
~~~~~
at file:///Users/eduardoboucas/Sites/tests/deno-20-test/index.ts:3:15