From 318dcc33afd510c02984d4d3527c88bf4383bcf1 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Thu, 4 Nov 2021 11:30:37 +0100 Subject: [PATCH] Revert "feat(cli): enable `useUnknownInCatchVariables` by default" (#12643) This partially reverts commit a065604155991dbf4417b606d4562d275cd8955f. Co-authored-by: Kitson Kelly --- cli/emit.rs | 4 ++++ cli/lsp/language_server.rs | 2 ++ cli/tests/integration/run_tests.rs | 7 ------- cli/tests/testdata/useUnknownInCatchVariables.ts | 5 ----- cli/tests/testdata/useUnknownInCatchVariables.ts.out | 5 ----- 5 files changed, 6 insertions(+), 17 deletions(-) delete mode 100644 cli/tests/testdata/useUnknownInCatchVariables.ts delete mode 100644 cli/tests/testdata/useUnknownInCatchVariables.ts.out diff --git a/cli/emit.rs b/cli/emit.rs index 6ef235b7db..9bd005b2aa 100644 --- a/cli/emit.rs +++ b/cli/emit.rs @@ -160,6 +160,8 @@ pub(crate) fn get_ts_config( "target": "esnext", "tsBuildInfoFile": "deno:///.tsbuildinfo", "useDefineForClassFields": true, + // TODO(@kitsonk) remove for Deno 2.0 + "useUnknownInCatchVariables": false, })); if tsc_emit { ts_config.merge(&json!({ @@ -211,6 +213,8 @@ pub(crate) fn get_ts_config( "target": "esnext", "tsBuildInfoFile": "deno:///.tsbuildinfo", "useDefineForClassFields": true, + // TODO(@kitsonk) remove for Deno 2.0 + "useUnknownInCatchVariables": false, })); if tsc_emit { ts_config.merge(&json!({ diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 0deac879f8..656bff1f4d 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -572,6 +572,8 @@ impl Inner { "strict": true, "target": "esnext", "useDefineForClassFields": true, + // TODO(@kitsonk) remove for Deno 1.15 + "useUnknownInCatchVariables": false, })); let config = &self.config; let workspace_settings = config.get_workspace_settings(); diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index b7480c44b1..f290c6e627 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -1367,13 +1367,6 @@ itest!(error_import_map_unable_to_load { exit_code: 1, }); -// This test ensure that useUnknownInCatchVariables is enabled by default. -itest!(use_unknown_in_catch_variables { - args: "run useUnknownInCatchVariables.ts", - output: "useUnknownInCatchVariables.ts.out", - exit_code: 1, -}); - // Test that setting `self` in the main thread to some other value doesn't break // the world. itest!(replace_self { diff --git a/cli/tests/testdata/useUnknownInCatchVariables.ts b/cli/tests/testdata/useUnknownInCatchVariables.ts deleted file mode 100644 index abab554a43..0000000000 --- a/cli/tests/testdata/useUnknownInCatchVariables.ts +++ /dev/null @@ -1,5 +0,0 @@ -try { - throw new Error(); -} catch (e) { - console.log(e.message); -} diff --git a/cli/tests/testdata/useUnknownInCatchVariables.ts.out b/cli/tests/testdata/useUnknownInCatchVariables.ts.out deleted file mode 100644 index 3c29d3229d..0000000000 --- a/cli/tests/testdata/useUnknownInCatchVariables.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -[WILDCARD] -error: TS2571 [ERROR]: Object is of type 'unknown'. - console.log(e.message); - ^ - at file://[WILDCARD]/useUnknownInCatchVariables.ts:4:15