Skip to content

Commit 7c01840

Browse files
Move option under 'strict'.
1 parent cccf22a commit 7c01840

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/compiler/checker.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ namespace ts {
354354
const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
355355
const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
356356
const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
357+
const useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
357358
const keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
358359
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : ObjectFlags.FreshLiteral;
359360

@@ -8603,7 +8604,7 @@ namespace ts {
86038604
const declaration = symbol.valueDeclaration;
86048605
if (isCatchClauseVariableDeclarationOrBindingElement(declaration)) {
86058606
const decl = declaration as VariableDeclaration;
8606-
if (!decl.type) return compilerOptions.useUnknownInCatchVariables ? unknownType : anyType;
8607+
if (!decl.type) return useUnknownInCatchVariables ? unknownType : anyType;
86078608
const type = getTypeOfNode(decl.type);
86088609
// an errorType will make `checkTryStatement` issue an error
86098610
return isTypeAny(type) || type === unknownType ? type : errorType;

src/compiler/utilities.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6002,6 +6002,7 @@ namespace ts {
60026002
| "strictBindCallApply"
60036003
| "strictPropertyInitialization"
60046004
| "alwaysStrict"
6005+
| "useUnknownInCatchVariables"
60056006
;
60066007

60076008
export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: StrictOptionName): boolean {

0 commit comments

Comments
 (0)