1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

feat(lsp): turn on useUnknownInCatchVariables (#25474)

This commit is contained in:
Kenta Moriuchi 2024-09-06 19:23:59 +09:00 committed by GitHub
parent 56363e4f4e
commit 8ef08f1d29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 16 additions and 3 deletions

View file

@ -1084,7 +1084,6 @@ impl Default for LspTsConfig {
"strict": true,
"target": "esnext",
"useDefineForClassFields": true,
"useUnknownInCatchVariables": false,
"jsx": "react",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",

View file

@ -223,7 +223,7 @@
"useUnknownInCatchVariables": {
"description": "Default catch clause variables as `unknown` instead of `any`.",
"type": "boolean",
"default": false,
"default": true,
"markdownDescription": "Default catch clause variables as `unknown` instead of `any`.\n\nSee more: https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables"
}
}

View file

@ -1152,7 +1152,6 @@ delete Object.prototype.__proto__;
"strict": true,
"target": "esnext",
"useDefineForClassFields": true,
"useUnknownInCatchVariables": false,
"jsx": "react",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",

View file

@ -0,0 +1,5 @@
{
"args": "check main.ts",
"output": "main.out",
"exitCode": 1
}

View file

@ -0,0 +1,5 @@
Check file:///[WILDCARD]/main.ts
error: TS18046 [ERROR]: 'e' is of type 'unknown'.
console.log(e.message);
^
at file://[WILDCARD]/use_unknown_in_catch_variables/main.ts:4:15

View file

@ -0,0 +1,5 @@
try {
throw new Error();
} catch (e) {
console.log(e.message);
}