Add flag to change catch variables' default types to unknown (#41013)

* Add test case for 'useUnknownInCatchVariables'.

* Add new 'useUnknownInCatchVariables' flag.

* Accepted baselines.

* Add test for catch variable explicitly typed as 'any'.

* Accepted baselines.

* Move option under 'strict'.

* Accepted baselines.

* 'useUnknownInCatchVariables' is strict in command line help.
This commit is contained in:
Daniel Rosenwasser
2021-06-03 13:12:56 -07:00
committed by GitHub
parent 6baa1bec64
commit 9906092db2
32 changed files with 378 additions and 18 deletions

View File

@@ -632,6 +632,15 @@ namespace ts {
category: Diagnostics.Type_Checking,
description: Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type,
},
{
name: "useUnknownInCatchVariables",
type: "boolean",
affectsSemanticDiagnostics: true,
strictFlag: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Type_Checking,
description: Diagnostics.Type_catch_clause_variables_as_unknown_instead_of_any,
},
{
name: "alwaysStrict",
type: "boolean",