mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
feat(lsp): turn on useUnknownInCatchVariables (#25474)
This commit is contained in:
parent
56363e4f4e
commit
8ef08f1d29
6 changed files with 16 additions and 3 deletions
|
@ -1084,7 +1084,6 @@ impl Default for LspTsConfig {
|
|||
"strict": true,
|
||||
"target": "esnext",
|
||||
"useDefineForClassFields": true,
|
||||
"useUnknownInCatchVariables": false,
|
||||
"jsx": "react",
|
||||
"jsxFactory": "React.createElement",
|
||||
"jsxFragmentFactory": "React.Fragment",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1152,7 +1152,6 @@ delete Object.prototype.__proto__;
|
|||
"strict": true,
|
||||
"target": "esnext",
|
||||
"useDefineForClassFields": true,
|
||||
"useUnknownInCatchVariables": false,
|
||||
"jsx": "react",
|
||||
"jsxFactory": "React.createElement",
|
||||
"jsxFragmentFactory": "React.Fragment",
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"args": "check main.ts",
|
||||
"output": "main.out",
|
||||
"exitCode": 1
|
||||
}
|
|
@ -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
|
5
tests/specs/check/use_unknown_in_catch_variables/main.ts
Normal file
5
tests/specs/check/use_unknown_in_catch_variables/main.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
try {
|
||||
throw new Error();
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
Loading…
Reference in a new issue