From 8cfabcaeb4ecf26bec2543b445c9a394e089061d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 2 Nov 2017 10:07:47 -0700 Subject: [PATCH] Remove strictTuple flag and Tuple.length readonly --- src/compiler/checker.ts | 10 +++------- src/compiler/commandLineParser.ts | 7 ------- src/compiler/core.ts | 2 +- src/compiler/diagnosticMessages.json | 4 ---- src/compiler/types.ts | 1 - 5 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 83220ed6c42..8bfd60e5659 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -67,7 +67,6 @@ namespace ts { const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ModuleKind.System; const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks"); const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes"); - const strictTuples = getStrictOptionValue(compilerOptions, "strictTuples"); const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny"); const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis"); @@ -7303,12 +7302,9 @@ namespace ts { property.type = typeParameter; properties.push(property); } - if (strictTuples) { - const lengthSymbol = createSymbol(SymbolFlags.Property, "length" as __String); - lengthSymbol.type = getLiteralType(arity); - lengthSymbol.checkFlags = CheckFlags.Readonly; - properties.push(lengthSymbol); - } + const lengthSymbol = createSymbol(SymbolFlags.Property, "length" as __String); + lengthSymbol.type = getLiteralType(arity); + properties.push(lengthSymbol); const type = createObjectType(ObjectFlags.Tuple | ObjectFlags.Reference); type.typeParameters = typeParameters; type.outerTypeParameters = undefined; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 2b6f4c266a1..b7003fbffd9 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -276,13 +276,6 @@ namespace ts { category: Diagnostics.Strict_Type_Checking_Options, description: Diagnostics.Enable_strict_checking_of_function_types }, - { - name: "strictTuples", - type: "boolean", - showInSimplifiedHelpView: true, - category: Diagnostics.Strict_Type_Checking_Options, - description: Diagnostics.Enable_strict_tuple_checks - }, { name: "noImplicitThis", type: "boolean", diff --git a/src/compiler/core.ts b/src/compiler/core.ts index eed627079b9..23493b3087d 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1684,7 +1684,7 @@ namespace ts { return moduleResolution; } - export type StrictOptionName = "noImplicitAny" | "noImplicitThis" | "strictNullChecks" | "strictFunctionTypes" | "strictTuples" | "alwaysStrict"; + export type StrictOptionName = "noImplicitAny" | "noImplicitThis" | "strictNullChecks" | "strictFunctionTypes" | "alwaysStrict"; export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: StrictOptionName): boolean { return compilerOptions[flag] === undefined ? compilerOptions.strict : compilerOptions[flag]; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 252ed7f77e7..8f855347bd8 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3326,10 +3326,6 @@ "category": "Message", "code": 6186 }, - "Enable strict tuple checks.": { - "category": "Message", - "code": 6187 - }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 95b87ab3853..549c0f8d52f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3785,7 +3785,6 @@ namespace ts { strict?: boolean; strictFunctionTypes?: boolean; // Always combine with strict property strictNullChecks?: boolean; // Always combine with strict property - strictTuples?: boolean; /* @internal */ stripInternal?: boolean; suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean;