Move option under 'strict'.

This commit is contained in:
Daniel Rosenwasser 2020-12-10 17:26:21 -08:00
parent cccf22a3cf
commit 7c01840b7d
2 changed files with 3 additions and 1 deletions

View File

@ -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;
@ -8603,7 +8604,7 @@ namespace ts {
const declaration = symbol.valueDeclaration;
if (isCatchClauseVariableDeclarationOrBindingElement(declaration)) {
const decl = declaration as VariableDeclaration;
if (!decl.type) return compilerOptions.useUnknownInCatchVariables ? unknownType : anyType;
if (!decl.type) return useUnknownInCatchVariables ? unknownType : anyType;
const type = getTypeOfNode(decl.type);
// an errorType will make `checkTryStatement` issue an error
return isTypeAny(type) || type === unknownType ? type : errorType;

View File

@ -6002,6 +6002,7 @@ namespace ts {
| "strictBindCallApply"
| "strictPropertyInitialization"
| "alwaysStrict"
| "useUnknownInCatchVariables"
;
export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: StrictOptionName): boolean {