From f5294570c8e1f71c678055cb90c2e2b97c562d6c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 5 May 2021 21:35:57 +0000 Subject: [PATCH] Move option under 'strict'. --- src/compiler/checker.ts | 3 ++- src/compiler/utilities.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3afe6983c6607..b098c42b53446 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -354,6 +354,7 @@ namespace ts { const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization"); const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny"); const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis"); + const useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables"); const keyofStringsOnly = !!compilerOptions.keyofStringsOnly; const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : ObjectFlags.FreshLiteral; @@ -8929,7 +8930,7 @@ namespace ts { if (isCatchClauseVariableDeclarationOrBindingElement(declaration)) { const typeNode = getEffectiveTypeAnnotationNode(declaration); if (typeNode === undefined) { - return compilerOptions.useUnknownInCatchVariables ? unknownType : anyType; + return useUnknownInCatchVariables ? unknownType : anyType; } const type = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9bbdea8a6ac2d..88ba75d138247 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6067,6 +6067,7 @@ namespace ts { | "strictBindCallApply" | "strictPropertyInitialization" | "alwaysStrict" + | "useUnknownInCatchVariables" ; export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: StrictOptionName): boolean {