From 8b90b8ddd6ebb6c17b1fb90aaa82ce6c2f60a39f Mon Sep 17 00:00:00 2001 From: kingwl Date: Wed, 15 Jul 2020 22:45:50 +0800 Subject: [PATCH 01/61] wip: add types --- src/compiler/types.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f2887624b8762..ac3db91bdb1fd 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -186,6 +186,7 @@ namespace ts { FromKeyword, GlobalKeyword, BigIntKeyword, + OverrideKeyword, OfKeyword, // LastKeyword and LastToken and LastContextualKeyword // Parse tree nodes @@ -581,6 +582,7 @@ namespace ts { | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword + | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword @@ -616,6 +618,7 @@ namespace ts { | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword + | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword ; @@ -1018,6 +1021,7 @@ namespace ts { export type ProtectedKeyword = ModifierToken; export type PublicKeyword = ModifierToken; export type ReadonlyKeyword = ModifierToken; + export type OverrideKeyword = ModifierToken; export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ @@ -1033,6 +1037,7 @@ namespace ts { | PrivateKeyword | ProtectedKeyword | PublicKeyword + | OverrideKeyword | ReadonlyKeyword | StaticKeyword ; From ea5608a2153e8ef42e74c730325164e3aef2c571 Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 17 Jul 2020 14:30:11 +0800 Subject: [PATCH 02/61] wip --- src/compiler/checker.ts | 36 +++++++++++++++++++ src/compiler/scanner.ts | 1 + src/compiler/types.ts | 1 + src/compiler/utilities.ts | 5 +++ src/compiler/utilitiesPublic.ts | 1 + tests/cases/conformance/override/override1.ts | 21 +++++++++++ 6 files changed, 65 insertions(+) create mode 100644 tests/cases/conformance/override/override1.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1314f1ae34d1d..45466006748e5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34375,6 +34375,11 @@ namespace ts { } } + + else { + issueMemberWithOverrideButNotInhert(node); + } + const implementedTypeNodes = getEffectiveImplementsTypeNodes(node); if (implementedTypeNodes) { for (const typeRefNode of implementedTypeNodes) { @@ -34409,6 +34414,37 @@ namespace ts { } } + function issueMemberWithOverrideButNotInhert(node: ClassLikeDeclaration) { + for (const member of node.members) { + if (hasOverrideModifier(member)) { + const modifier = member.modifiers?.find(modifier => modifier.kind === SyntaxKind.OverrideKeyword) + Debug.assertIsDefined(modifier) + error(modifier, Diagnostics.Expression_expected); + } + } + } + + function issueMemberWithOverride (node: ClassLikeDeclaration) { + + } + + function issueMemberWithOverrideButNotExistedInBase(node: ClassDeclaration, typeWithThis: Type, baseWithThis: Type) { + for (const member of node.members) { + const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); + if (declaredProp) { + const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); + const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); + const hasOVerride = hasOverrideModifier(member); + if (prop && !baseProp && hasOVerride) { + error(member, Diagnostics.Expression_expected); + } + if (prop && baseProp && !hasOVerride) { + error(member, Diagnostics.Expression_expected); + } + } + } + } + function issueMemberSpecificError(node: ClassLikeDeclaration, typeWithThis: Type, baseWithThis: Type, broadDiag: DiagnosticMessage) { // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible let issuedMemberError = false; diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 77ec82ffef760..417e9d9d3035e 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -125,6 +125,7 @@ namespace ts { private: SyntaxKind.PrivateKeyword, protected: SyntaxKind.ProtectedKeyword, public: SyntaxKind.PublicKeyword, + override: SyntaxKind.OverrideKeyword, readonly: SyntaxKind.ReadonlyKeyword, require: SyntaxKind.RequireKeyword, global: SyntaxKind.GlobalKeyword, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ac3db91bdb1fd..9056aa073fcb5 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -792,6 +792,7 @@ namespace ts { HasComputedJSDocModifiers = 1 << 12, // Indicates the computed modifier flags include modifiers from JSDoc. Deprecated = 1 << 13, // Deprecated tag. + Override = 1 << 14, // Override method. HasComputedFlags = 1 << 29, // Modifier flags have been computed AccessibilityModifier = Public | Private | Protected, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 724e6a8754c01..7046ac95d538c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4529,6 +4529,10 @@ namespace ts { return hasSyntacticModifier(node, ModifierFlags.Static); } + export function hasOverrideModifier(node: Node): boolean { + return hasSyntacticModifier(node, ModifierFlags.Override); + } + export function hasEffectiveReadonlyModifier(node: Node): boolean { return hasEffectiveModifier(node, ModifierFlags.Readonly); } @@ -4639,6 +4643,7 @@ namespace ts { case SyntaxKind.DefaultKeyword: return ModifierFlags.Default; case SyntaxKind.AsyncKeyword: return ModifierFlags.Async; case SyntaxKind.ReadonlyKeyword: return ModifierFlags.Readonly; + case SyntaxKind.OverrideKeyword: return ModifierFlags.Override; } return ModifierFlags.None; } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index e9d28e8fab5c1..e624453a2e787 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1129,6 +1129,7 @@ namespace ts { case SyntaxKind.ProtectedKeyword: case SyntaxKind.ReadonlyKeyword: case SyntaxKind.StaticKeyword: + case SyntaxKind.OverrideKeyword: return true; } return false; diff --git a/tests/cases/conformance/override/override1.ts b/tests/cases/conformance/override/override1.ts new file mode 100644 index 0000000000000..f0dec17939cef --- /dev/null +++ b/tests/cases/conformance/override/override1.ts @@ -0,0 +1,21 @@ +class B { + foo (v: string) { + + } +} + +class D extends B { + override foo (v: string) { + + } + + override bar(v: string) { + + } +} + +class C { + override foo(v: string) { + + } +} \ No newline at end of file From 9371d878d4213afbd470c8d4632fbc79a570cdec Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 17 Jul 2020 15:42:57 +0800 Subject: [PATCH 03/61] Add cases --- src/compiler/checker.ts | 53 +++++++--------- .../baselines/reference/override1.errors.txt | 30 +++++++++ tests/baselines/reference/override1.js | 62 +++++++++++++++++++ tests/baselines/reference/override1.symbols | 37 +++++++++++ tests/baselines/reference/override1.types | 37 +++++++++++ 5 files changed, 190 insertions(+), 29 deletions(-) create mode 100644 tests/baselines/reference/override1.errors.txt create mode 100644 tests/baselines/reference/override1.js create mode 100644 tests/baselines/reference/override1.symbols create mode 100644 tests/baselines/reference/override1.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 45466006748e5..76990a384700e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34375,10 +34375,7 @@ namespace ts { } } - - else { - issueMemberWithOverrideButNotInhert(node); - } + issueMemberWithOverride(node, type, typeWithThis); const implementedTypeNodes = getEffectiveImplementsTypeNodes(node); if (implementedTypeNodes) { @@ -34414,32 +34411,30 @@ namespace ts { } } - function issueMemberWithOverrideButNotInhert(node: ClassLikeDeclaration) { - for (const member of node.members) { - if (hasOverrideModifier(member)) { - const modifier = member.modifiers?.find(modifier => modifier.kind === SyntaxKind.OverrideKeyword) - Debug.assertIsDefined(modifier) - error(modifier, Diagnostics.Expression_expected); - } - } - } - - function issueMemberWithOverride (node: ClassLikeDeclaration) { - - } - - function issueMemberWithOverrideButNotExistedInBase(node: ClassDeclaration, typeWithThis: Type, baseWithThis: Type) { + function issueMemberWithOverride (node: ClassLikeDeclaration, type: InterfaceType, typeWithThis: Type) { + const baseTypeNode = getEffectiveBaseTypeNode(node); for (const member of node.members) { - const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); - if (declaredProp) { - const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); - const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); - const hasOVerride = hasOverrideModifier(member); - if (prop && !baseProp && hasOVerride) { - error(member, Diagnostics.Expression_expected); - } - if (prop && baseProp && !hasOVerride) { - error(member, Diagnostics.Expression_expected); + const hasOverride = hasOverrideModifier(member); + if (hasOverride && !baseTypeNode) { + error(member, Diagnostics._0_is_deprecated, 'has override but not extended') + } + else if (baseTypeNode) { + const baseTypes = getBaseTypes(type); + if (baseTypes.length) { + const baseType = first(baseTypes); + const baseWithThis = getTypeWithThisArgument(baseType, type.thisType); + + const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); + if (declaredProp) { + const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); + const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); + if (prop && !baseProp && hasOverride) { + error(member, Diagnostics._0_is_deprecated, 'not founded in base class') + } + else if (prop && baseProp && !hasOverride) { + error(member, Diagnostics._0_is_deprecated, 'need override') + } + } } } } diff --git a/tests/baselines/reference/override1.errors.txt b/tests/baselines/reference/override1.errors.txt new file mode 100644 index 0000000000000..db63b6ffd9cd3 --- /dev/null +++ b/tests/baselines/reference/override1.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/override/override1.ts(12,14): suggestion TS6385: 'not founded in base class' is deprecated +tests/cases/conformance/override/override1.ts(18,14): suggestion TS6385: 'has override but not extended' is deprecated + + +==== tests/cases/conformance/override/override1.ts (2 errors) ==== + class B { + foo (v: string) { + + } + } + + class D extends B { + override foo (v: string) { + + } + + override bar(v: string) { + ~~~ +!!! suggestion TS6385: 'not founded in base class' is deprecated + + } + } + + class C { + override foo(v: string) { + ~~~ +!!! suggestion TS6385: 'has override but not extended' is deprecated + + } + } \ No newline at end of file diff --git a/tests/baselines/reference/override1.js b/tests/baselines/reference/override1.js new file mode 100644 index 0000000000000..04b048d1ca444 --- /dev/null +++ b/tests/baselines/reference/override1.js @@ -0,0 +1,62 @@ +//// [override1.ts] +class B { + foo (v: string) { + + } +} + +class D extends B { + override foo (v: string) { + + } + + override bar(v: string) { + + } +} + +class C { + override foo(v: string) { + + } +} + +//// [override1.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var B = /** @class */ (function () { + function B() { + } + B.prototype.foo = function (v) { + }; + return B; +}()); +var D = /** @class */ (function (_super) { + __extends(D, _super); + function D() { + return _super !== null && _super.apply(this, arguments) || this; + } + D.prototype.foo = function (v) { + }; + D.prototype.bar = function (v) { + }; + return D; +}(B)); +var C = /** @class */ (function () { + function C() { + } + C.prototype.foo = function (v) { + }; + return C; +}()); diff --git a/tests/baselines/reference/override1.symbols b/tests/baselines/reference/override1.symbols new file mode 100644 index 0000000000000..a061b41d509d5 --- /dev/null +++ b/tests/baselines/reference/override1.symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/override/override1.ts === +class B { +>B : Symbol(B, Decl(override1.ts, 0, 0)) + + foo (v: string) { +>foo : Symbol(B.foo, Decl(override1.ts, 0, 9)) +>v : Symbol(v, Decl(override1.ts, 1, 9)) + + } +} + +class D extends B { +>D : Symbol(D, Decl(override1.ts, 4, 1)) +>B : Symbol(B, Decl(override1.ts, 0, 0)) + + override foo (v: string) { +>foo : Symbol(D.foo, Decl(override1.ts, 6, 19)) +>v : Symbol(v, Decl(override1.ts, 7, 18)) + + } + + override bar(v: string) { +>bar : Symbol(D.bar, Decl(override1.ts, 9, 5)) +>v : Symbol(v, Decl(override1.ts, 11, 17)) + + } +} + +class C { +>C : Symbol(C, Decl(override1.ts, 14, 1)) + + override foo(v: string) { +>foo : Symbol(C.foo, Decl(override1.ts, 16, 9)) +>v : Symbol(v, Decl(override1.ts, 17, 17)) + + } +} diff --git a/tests/baselines/reference/override1.types b/tests/baselines/reference/override1.types new file mode 100644 index 0000000000000..3d9732b7af402 --- /dev/null +++ b/tests/baselines/reference/override1.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/override/override1.ts === +class B { +>B : B + + foo (v: string) { +>foo : (v: string) => void +>v : string + + } +} + +class D extends B { +>D : D +>B : B + + override foo (v: string) { +>foo : (v: string) => void +>v : string + + } + + override bar(v: string) { +>bar : (v: string) => void +>v : string + + } +} + +class C { +>C : C + + override foo(v: string) { +>foo : (v: string) => void +>v : string + + } +} From 6cb7f5e3bba5a6641c8b3aae41c58a0a77678ae3 Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 17 Jul 2020 15:47:32 +0800 Subject: [PATCH 04/61] Add some case --- .../baselines/reference/override1.errors.txt | 16 ++++++++--- tests/baselines/reference/override1.js | 11 ++++++++ tests/baselines/reference/override1.symbols | 27 +++++++++++++------ tests/baselines/reference/override1.types | 11 ++++++++ tests/cases/conformance/override/override1.ts | 7 +++++ 5 files changed, 61 insertions(+), 11 deletions(-) diff --git a/tests/baselines/reference/override1.errors.txt b/tests/baselines/reference/override1.errors.txt index db63b6ffd9cd3..d3cd758d494c3 100644 --- a/tests/baselines/reference/override1.errors.txt +++ b/tests/baselines/reference/override1.errors.txt @@ -1,11 +1,15 @@ -tests/cases/conformance/override/override1.ts(12,14): suggestion TS6385: 'not founded in base class' is deprecated -tests/cases/conformance/override/override1.ts(18,14): suggestion TS6385: 'has override but not extended' is deprecated +tests/cases/conformance/override/override1.ts(15,5): suggestion TS6385: 'need override' is deprecated +tests/cases/conformance/override/override1.ts(19,14): suggestion TS6385: 'not founded in base class' is deprecated +tests/cases/conformance/override/override1.ts(25,14): suggestion TS6385: 'has override but not extended' is deprecated -==== tests/cases/conformance/override/override1.ts (2 errors) ==== +==== tests/cases/conformance/override/override1.ts (3 errors) ==== class B { foo (v: string) { + } + fooo (v: string) { + } } @@ -14,6 +18,12 @@ tests/cases/conformance/override/override1.ts(18,14): suggestion TS6385: 'has ov } + fooo (v: string) { + ~~~~ +!!! suggestion TS6385: 'need override' is deprecated + + } + override bar(v: string) { ~~~ !!! suggestion TS6385: 'not founded in base class' is deprecated diff --git a/tests/baselines/reference/override1.js b/tests/baselines/reference/override1.js index 04b048d1ca444..2b1e913e13d6c 100644 --- a/tests/baselines/reference/override1.js +++ b/tests/baselines/reference/override1.js @@ -2,6 +2,9 @@ class B { foo (v: string) { + } + fooo (v: string) { + } } @@ -10,6 +13,10 @@ class D extends B { } + fooo (v: string) { + + } + override bar(v: string) { } @@ -40,6 +47,8 @@ var B = /** @class */ (function () { } B.prototype.foo = function (v) { }; + B.prototype.fooo = function (v) { + }; return B; }()); var D = /** @class */ (function (_super) { @@ -49,6 +58,8 @@ var D = /** @class */ (function (_super) { } D.prototype.foo = function (v) { }; + D.prototype.fooo = function (v) { + }; D.prototype.bar = function (v) { }; return D; diff --git a/tests/baselines/reference/override1.symbols b/tests/baselines/reference/override1.symbols index a061b41d509d5..83712c645ecc1 100644 --- a/tests/baselines/reference/override1.symbols +++ b/tests/baselines/reference/override1.symbols @@ -6,32 +6,43 @@ class B { >foo : Symbol(B.foo, Decl(override1.ts, 0, 9)) >v : Symbol(v, Decl(override1.ts, 1, 9)) + } + fooo (v: string) { +>fooo : Symbol(B.fooo, Decl(override1.ts, 3, 5)) +>v : Symbol(v, Decl(override1.ts, 4, 10)) + } } class D extends B { ->D : Symbol(D, Decl(override1.ts, 4, 1)) +>D : Symbol(D, Decl(override1.ts, 7, 1)) >B : Symbol(B, Decl(override1.ts, 0, 0)) override foo (v: string) { ->foo : Symbol(D.foo, Decl(override1.ts, 6, 19)) ->v : Symbol(v, Decl(override1.ts, 7, 18)) +>foo : Symbol(D.foo, Decl(override1.ts, 9, 19)) +>v : Symbol(v, Decl(override1.ts, 10, 18)) } + fooo (v: string) { +>fooo : Symbol(D.fooo, Decl(override1.ts, 12, 5)) +>v : Symbol(v, Decl(override1.ts, 14, 10)) + + } + override bar(v: string) { ->bar : Symbol(D.bar, Decl(override1.ts, 9, 5)) ->v : Symbol(v, Decl(override1.ts, 11, 17)) +>bar : Symbol(D.bar, Decl(override1.ts, 16, 5)) +>v : Symbol(v, Decl(override1.ts, 18, 17)) } } class C { ->C : Symbol(C, Decl(override1.ts, 14, 1)) +>C : Symbol(C, Decl(override1.ts, 21, 1)) override foo(v: string) { ->foo : Symbol(C.foo, Decl(override1.ts, 16, 9)) ->v : Symbol(v, Decl(override1.ts, 17, 17)) +>foo : Symbol(C.foo, Decl(override1.ts, 23, 9)) +>v : Symbol(v, Decl(override1.ts, 24, 17)) } } diff --git a/tests/baselines/reference/override1.types b/tests/baselines/reference/override1.types index 3d9732b7af402..53d5b388ce1fa 100644 --- a/tests/baselines/reference/override1.types +++ b/tests/baselines/reference/override1.types @@ -4,6 +4,11 @@ class B { foo (v: string) { >foo : (v: string) => void +>v : string + + } + fooo (v: string) { +>fooo : (v: string) => void >v : string } @@ -19,6 +24,12 @@ class D extends B { } + fooo (v: string) { +>fooo : (v: string) => void +>v : string + + } + override bar(v: string) { >bar : (v: string) => void >v : string diff --git a/tests/cases/conformance/override/override1.ts b/tests/cases/conformance/override/override1.ts index f0dec17939cef..d6306ab9ecb08 100644 --- a/tests/cases/conformance/override/override1.ts +++ b/tests/cases/conformance/override/override1.ts @@ -1,6 +1,9 @@ class B { foo (v: string) { + } + fooo (v: string) { + } } @@ -9,6 +12,10 @@ class D extends B { } + fooo (v: string) { + + } + override bar(v: string) { } From 061cd27da6dadcaaed23ffaab38bae20a343808c Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 20 Jul 2020 14:36:24 +0800 Subject: [PATCH 05/61] Add more check --- src/compiler/checker.ts | 43 ++++---- src/compiler/commandLineParser.ts | 8 ++ src/compiler/diagnosticMessages.json | 16 +++ src/compiler/types.ts | 1 + .../baselines/reference/override1.errors.txt | 77 +++++++++---- tests/baselines/reference/override1.js | 101 +++++++++++++----- tests/baselines/reference/override1.symbols | 93 +++++++++++----- tests/baselines/reference/override1.types | 76 ++++++++++--- tests/cases/conformance/override/override1.ts | 47 +++++--- 9 files changed, 335 insertions(+), 127 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 76990a384700e..c24c162442058 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34375,7 +34375,9 @@ namespace ts { } } - issueMemberWithOverride(node, type, typeWithThis); + if (compilerOptions.pedanticOverride) { + issueMemberWithOverride(node, type, typeWithThis); + } const implementedTypeNodes = getEffectiveImplementsTypeNodes(node); if (implementedTypeNodes) { @@ -34411,32 +34413,31 @@ namespace ts { } } - function issueMemberWithOverride (node: ClassLikeDeclaration, type: InterfaceType, typeWithThis: Type) { + function issueMemberWithOverride(node: ClassLikeDeclaration, type: InterfaceType, typeWithThis: Type) { const baseTypeNode = getEffectiveBaseTypeNode(node); + const baseTypes = baseTypeNode && getBaseTypes(type); + const baseWithThis = baseTypes?.length ? getTypeWithThisArgument(first(baseTypes), type.thisType) : undefined; + for (const member of node.members) { const hasOverride = hasOverrideModifier(member); - if (hasOverride && !baseTypeNode) { - error(member, Diagnostics._0_is_deprecated, 'has override but not extended') - } - else if (baseTypeNode) { - const baseTypes = getBaseTypes(type); - if (baseTypes.length) { - const baseType = first(baseTypes); - const baseWithThis = getTypeWithThisArgument(baseType, type.thisType); - - const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); - if (declaredProp) { - const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); - const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); - if (prop && !baseProp && hasOverride) { - error(member, Diagnostics._0_is_deprecated, 'not founded in base class') - } - else if (prop && baseProp && !hasOverride) { - error(member, Diagnostics._0_is_deprecated, 'need override') - } + if (baseWithThis) { + const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); + if (declaredProp) { + const baseClassName = typeToString(baseWithThis); + const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); + const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); + if (prop && !baseProp && hasOverride) { + error(member, Diagnostics.Method_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0, baseClassName); + } + else if (prop && baseProp && !hasOverride) { + error(member, Diagnostics.Method_must_have_override_modifier_because_it_s_override_the_base_class_0, baseClassName); } } } + else if (hasOverride) { + const className = typeToString(type); + error(member, Diagnostics.Method_cannot_have_override_modifier_because_class_0_does_not_extended_another_class, className); + } } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index f5cb2990a593a..980d01c3b250d 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -606,6 +606,14 @@ namespace ts { category: Diagnostics.Additional_Checks, description: Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement }, + { + name: "pedanticOverride", + type: "boolean", + affectsSemanticDiagnostics: true, + showInSimplifiedHelpView: false, + category: Diagnostics.Additional_Checks, + description: Diagnostics.Required_override_modifier_in_class_element + }, // Module Resolution { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 70bb5b5882546..18c67a4cff5b9 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3361,6 +3361,18 @@ "category": "Error", "code": 4110 }, + "Method cannot have override modifier because class '{0}' does not extended another class.": { + "category": "Error", + "code": 4111 + }, + "Method cannot have override modifier because it's not existed in the base class '{0}'.": { + "category": "Error", + "code": 4112 + }, + "Method must have override modifier because it's override the base class '{0}'.": { + "category": "Error", + "code": 4113 + }, "The current host does not support the '{0}' option.": { "category": "Error", @@ -4653,6 +4665,10 @@ "category": "Error", "code": 6504 }, + "Required override modifier in class element": { + "category": "Error", + "code": 6801 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9056aa073fcb5..308a80b2cc895 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5719,6 +5719,7 @@ namespace ts { paths?: MapLike; /*@internal*/ plugins?: PluginImport[]; preserveConstEnums?: boolean; + pedanticOverride?: boolean; preserveSymlinks?: boolean; /* @internal */ preserveWatchOutput?: boolean; project?: string; diff --git a/tests/baselines/reference/override1.errors.txt b/tests/baselines/reference/override1.errors.txt index d3cd758d494c3..002538a443664 100644 --- a/tests/baselines/reference/override1.errors.txt +++ b/tests/baselines/reference/override1.errors.txt @@ -1,40 +1,71 @@ -tests/cases/conformance/override/override1.ts(15,5): suggestion TS6385: 'need override' is deprecated -tests/cases/conformance/override/override1.ts(19,14): suggestion TS6385: 'not founded in base class' is deprecated -tests/cases/conformance/override/override1.ts(25,14): suggestion TS6385: 'has override but not extended' is deprecated +tests/cases/conformance/override/override1.ts(9,5): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override1.ts(11,14): error TS4112: Method cannot have override modifier because it's not existed in the base class 'B'. +tests/cases/conformance/override/override1.ts(15,14): error TS4111: Method cannot have override modifier because class 'C' does not extended another class. +tests/cases/conformance/override/override1.ts(22,9): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override1.ts(24,18): error TS4112: Method cannot have override modifier because it's not existed in the base class 'B'. +tests/cases/conformance/override/override1.ts(33,5): error TS4113: Method must have override modifier because it's override the base class '(Anonymous class)'. +tests/cases/conformance/override/override1.ts(37,14): error TS4112: Method cannot have override modifier because it's not existed in the base class '(Anonymous class)'. +tests/cases/conformance/override/override1.ts(42,18): error TS4111: Method cannot have override modifier because class '(Anonymous class)' does not extended another class. -==== tests/cases/conformance/override/override1.ts (3 errors) ==== +==== tests/cases/conformance/override/override1.ts (8 errors) ==== class B { - foo (v: string) { - - } - fooo (v: string) { - - } + foo (v: string) {} + fooo (v: string) {} } class D extends B { - override foo (v: string) { + override foo (v: string) {} - } - - fooo (v: string) { + fooo (v: string) {} ~~~~ -!!! suggestion TS6385: 'need override' is deprecated - - } +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. - override bar(v: string) { + override bar(v: string) {} ~~~ -!!! suggestion TS6385: 'not founded in base class' is deprecated - - } +!!! error TS4112: Method cannot have override modifier because it's not existed in the base class 'B'. } class C { - override foo(v: string) { + override foo(v: string) {} ~~~ -!!! suggestion TS6385: 'has override but not extended' is deprecated +!!! error TS4111: Method cannot have override modifier because class 'C' does not extended another class. + } + + function f () { + return class extends B { + override foo (v: string) {} + + fooo (v: string) {} + ~~~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. + + override bar(v: string) {} + ~~~ +!!! error TS4112: Method cannot have override modifier because it's not existed in the base class 'B'. + } + } + + class E extends (class { + foo () { } + bar () { } + }) { + override foo () { } + bar () { } + ~~~ +!!! error TS4113: Method must have override modifier because it's override the base class '(Anonymous class)'. + + baz() {} + + override bazz () {} + ~~~~ +!!! error TS4112: Method cannot have override modifier because it's not existed in the base class '(Anonymous class)'. + } + function ff () { + return class { + override foo () {} + ~~~ +!!! error TS4111: Method cannot have override modifier because class '(Anonymous class)' does not extended another class. } } \ No newline at end of file diff --git a/tests/baselines/reference/override1.js b/tests/baselines/reference/override1.js index 2b1e913e13d6c..d7c8d1af5aeb1 100644 --- a/tests/baselines/reference/override1.js +++ b/tests/baselines/reference/override1.js @@ -1,30 +1,46 @@ //// [override1.ts] class B { - foo (v: string) { - - } - fooo (v: string) { - - } + foo (v: string) {} + fooo (v: string) {} } class D extends B { - override foo (v: string) { + override foo (v: string) {} - } + fooo (v: string) {} - fooo (v: string) { - - } + override bar(v: string) {} +} - override bar(v: string) { - +class C { + override foo(v: string) {} +} + +function f () { + return class extends B { + override foo (v: string) {} + + fooo (v: string) {} + + override bar(v: string) {} } } -class C { - override foo(v: string) { +class E extends (class { + foo () { } + bar () { } +}) { + override foo () { } + bar () { } + + baz() {} + override bazz () {} +} + +function ff () { + return class { + override foo () {} } } @@ -45,10 +61,8 @@ var __extends = (this && this.__extends) || (function () { var B = /** @class */ (function () { function B() { } - B.prototype.foo = function (v) { - }; - B.prototype.fooo = function (v) { - }; + B.prototype.foo = function (v) { }; + B.prototype.fooo = function (v) { }; return B; }()); var D = /** @class */ (function (_super) { @@ -56,18 +70,51 @@ var D = /** @class */ (function (_super) { function D() { return _super !== null && _super.apply(this, arguments) || this; } - D.prototype.foo = function (v) { - }; - D.prototype.fooo = function (v) { - }; - D.prototype.bar = function (v) { - }; + D.prototype.foo = function (v) { }; + D.prototype.fooo = function (v) { }; + D.prototype.bar = function (v) { }; return D; }(B)); var C = /** @class */ (function () { function C() { } - C.prototype.foo = function (v) { - }; + C.prototype.foo = function (v) { }; return C; }()); +function f() { + return /** @class */ (function (_super) { + __extends(class_1, _super); + function class_1() { + return _super !== null && _super.apply(this, arguments) || this; + } + class_1.prototype.foo = function (v) { }; + class_1.prototype.fooo = function (v) { }; + class_1.prototype.bar = function (v) { }; + return class_1; + }(B)); +} +var E = /** @class */ (function (_super) { + __extends(E, _super); + function E() { + return _super !== null && _super.apply(this, arguments) || this; + } + E.prototype.foo = function () { }; + E.prototype.bar = function () { }; + E.prototype.baz = function () { }; + E.prototype.bazz = function () { }; + return E; +}((/** @class */ (function () { + function class_2() { + } + class_2.prototype.foo = function () { }; + class_2.prototype.bar = function () { }; + return class_2; +}())))); +function ff() { + return /** @class */ (function () { + function class_3() { + } + class_3.prototype.foo = function () { }; + return class_3; + }()); +} diff --git a/tests/baselines/reference/override1.symbols b/tests/baselines/reference/override1.symbols index 83712c645ecc1..18aa50df1d17a 100644 --- a/tests/baselines/reference/override1.symbols +++ b/tests/baselines/reference/override1.symbols @@ -2,47 +2,88 @@ class B { >B : Symbol(B, Decl(override1.ts, 0, 0)) - foo (v: string) { + foo (v: string) {} >foo : Symbol(B.foo, Decl(override1.ts, 0, 9)) >v : Symbol(v, Decl(override1.ts, 1, 9)) - } - fooo (v: string) { ->fooo : Symbol(B.fooo, Decl(override1.ts, 3, 5)) ->v : Symbol(v, Decl(override1.ts, 4, 10)) - - } + fooo (v: string) {} +>fooo : Symbol(B.fooo, Decl(override1.ts, 1, 22)) +>v : Symbol(v, Decl(override1.ts, 2, 10)) } class D extends B { ->D : Symbol(D, Decl(override1.ts, 7, 1)) +>D : Symbol(D, Decl(override1.ts, 3, 1)) >B : Symbol(B, Decl(override1.ts, 0, 0)) - override foo (v: string) { ->foo : Symbol(D.foo, Decl(override1.ts, 9, 19)) ->v : Symbol(v, Decl(override1.ts, 10, 18)) + override foo (v: string) {} +>foo : Symbol(D.foo, Decl(override1.ts, 5, 19)) +>v : Symbol(v, Decl(override1.ts, 6, 18)) - } + fooo (v: string) {} +>fooo : Symbol(D.fooo, Decl(override1.ts, 6, 31)) +>v : Symbol(v, Decl(override1.ts, 8, 10)) - fooo (v: string) { ->fooo : Symbol(D.fooo, Decl(override1.ts, 12, 5)) ->v : Symbol(v, Decl(override1.ts, 14, 10)) - - } + override bar(v: string) {} +>bar : Symbol(D.bar, Decl(override1.ts, 8, 23)) +>v : Symbol(v, Decl(override1.ts, 10, 17)) +} + +class C { +>C : Symbol(C, Decl(override1.ts, 11, 1)) + + override foo(v: string) {} +>foo : Symbol(C.foo, Decl(override1.ts, 13, 9)) +>v : Symbol(v, Decl(override1.ts, 14, 17)) +} + +function f () { +>f : Symbol(f, Decl(override1.ts, 15, 1)) - override bar(v: string) { ->bar : Symbol(D.bar, Decl(override1.ts, 16, 5)) ->v : Symbol(v, Decl(override1.ts, 18, 17)) - + return class extends B { +>B : Symbol(B, Decl(override1.ts, 0, 0)) + + override foo (v: string) {} +>foo : Symbol((Anonymous class).foo, Decl(override1.ts, 18, 28)) +>v : Symbol(v, Decl(override1.ts, 19, 22)) + + fooo (v: string) {} +>fooo : Symbol((Anonymous class).fooo, Decl(override1.ts, 19, 35)) +>v : Symbol(v, Decl(override1.ts, 21, 14)) + + override bar(v: string) {} +>bar : Symbol((Anonymous class).bar, Decl(override1.ts, 21, 27)) +>v : Symbol(v, Decl(override1.ts, 23, 21)) } } -class C { ->C : Symbol(C, Decl(override1.ts, 21, 1)) +class E extends (class { +>E : Symbol(E, Decl(override1.ts, 25, 1)) + + foo () { } +>foo : Symbol((Anonymous class).foo, Decl(override1.ts, 27, 24)) + + bar () { } +>bar : Symbol((Anonymous class).bar, Decl(override1.ts, 28, 14)) + +}) { + override foo () { } +>foo : Symbol(E.foo, Decl(override1.ts, 30, 4)) + + bar () { } +>bar : Symbol(E.bar, Decl(override1.ts, 31, 23)) + + baz() {} +>baz : Symbol(E.baz, Decl(override1.ts, 32, 14)) + + override bazz () {} +>bazz : Symbol(E.bazz, Decl(override1.ts, 34, 12)) +} - override foo(v: string) { ->foo : Symbol(C.foo, Decl(override1.ts, 23, 9)) ->v : Symbol(v, Decl(override1.ts, 24, 17)) +function ff () { +>ff : Symbol(ff, Decl(override1.ts, 37, 1)) + return class { + override foo () {} +>foo : Symbol((Anonymous class).foo, Decl(override1.ts, 40, 18)) } } diff --git a/tests/baselines/reference/override1.types b/tests/baselines/reference/override1.types index 53d5b388ce1fa..e65e151a7e53f 100644 --- a/tests/baselines/reference/override1.types +++ b/tests/baselines/reference/override1.types @@ -2,47 +2,93 @@ class B { >B : B - foo (v: string) { + foo (v: string) {} >foo : (v: string) => void >v : string - } - fooo (v: string) { + fooo (v: string) {} >fooo : (v: string) => void >v : string - - } } class D extends B { >D : D >B : B - override foo (v: string) { + override foo (v: string) {} >foo : (v: string) => void >v : string - } - - fooo (v: string) { + fooo (v: string) {} >fooo : (v: string) => void >v : string - - } - override bar(v: string) { + override bar(v: string) {} >bar : (v: string) => void >v : string - - } } class C { >C : C - override foo(v: string) { + override foo(v: string) {} >foo : (v: string) => void >v : string +} + +function f () { +>f : () => typeof (Anonymous class) + + return class extends B { +>class extends B { override foo (v: string) {} fooo (v: string) {} override bar(v: string) {} } : typeof (Anonymous class) +>B : B + + override foo (v: string) {} +>foo : (v: string) => void +>v : string + + fooo (v: string) {} +>fooo : (v: string) => void +>v : string + + override bar(v: string) {} +>bar : (v: string) => void +>v : string + } +} + +class E extends (class { +>E : E +>(class { foo () { } bar () { }}) : (Anonymous class) +>class { foo () { } bar () { }} : typeof (Anonymous class) + + foo () { } +>foo : () => void + + bar () { } +>bar : () => void + +}) { + override foo () { } +>foo : () => void + + bar () { } +>bar : () => void + + baz() {} +>baz : () => void + + override bazz () {} +>bazz : () => void +} + +function ff () { +>ff : () => typeof (Anonymous class) + + return class { +>class { override foo () {} } : typeof (Anonymous class) + override foo () {} +>foo : () => void } } diff --git a/tests/cases/conformance/override/override1.ts b/tests/cases/conformance/override/override1.ts index d6306ab9ecb08..9e7e18083591d 100644 --- a/tests/cases/conformance/override/override1.ts +++ b/tests/cases/conformance/override/override1.ts @@ -1,28 +1,45 @@ +// @pedanticOverride: true class B { - foo (v: string) { - - } - fooo (v: string) { - - } + foo (v: string) {} + fooo (v: string) {} } class D extends B { - override foo (v: string) { + override foo (v: string) {} - } + fooo (v: string) {} - fooo (v: string) { - - } + override bar(v: string) {} +} - override bar(v: string) { - +class C { + override foo(v: string) {} +} + +function f () { + return class extends B { + override foo (v: string) {} + + fooo (v: string) {} + + override bar(v: string) {} } } -class C { - override foo(v: string) { +class E extends (class { + foo () { } + bar () { } +}) { + override foo () { } + bar () { } + + baz() {} + + override bazz () {} +} +function ff () { + return class { + override foo () {} } } \ No newline at end of file From 37ada550e21b28a8b6cd0627c87374497fd35687 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 20 Jul 2020 15:15:41 +0800 Subject: [PATCH 06/61] accept baseline --- .../reference/api/tsserverlibrary.d.ts | 396 +++++++++--------- tests/baselines/reference/api/typescript.d.ts | 396 +++++++++--------- .../pedanticOverride/tsconfig.json | 5 + .../tsconfig.json | 1 + .../tsconfig.json | 1 + .../tsconfig.json | 1 + .../tsconfig.json | 1 + .../tsconfig.json | 1 + .../tsconfig.json | 1 + .../tsconfig.json | 1 + .../tsconfig.json | 1 + .../tsconfig.json | 1 + .../declarationDir-is-specified.js | 1 + ...-outDir-and-declarationDir-is-specified.js | 1 + .../when-outDir-is-specified.js | 1 + .../with-outFile.js | 1 + ...e-is-specified-with-declaration-enabled.js | 1 + .../without-outDir-or-outFile-is-specified.js | 1 + 18 files changed, 420 insertions(+), 392 deletions(-) create mode 100644 tests/baselines/reference/showConfig/Shows tsconfig for single option/pedanticOverride/tsconfig.json diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 8442b93e4f686..2d4e005f10f42 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -259,188 +259,189 @@ declare namespace ts { FromKeyword = 152, GlobalKeyword = 153, BigIntKeyword = 154, - OfKeyword = 155, - QualifiedName = 156, - ComputedPropertyName = 157, - TypeParameter = 158, - Parameter = 159, - Decorator = 160, - PropertySignature = 161, - PropertyDeclaration = 162, - MethodSignature = 163, - MethodDeclaration = 164, - Constructor = 165, - GetAccessor = 166, - SetAccessor = 167, - CallSignature = 168, - ConstructSignature = 169, - IndexSignature = 170, - TypePredicate = 171, - TypeReference = 172, - FunctionType = 173, - ConstructorType = 174, - TypeQuery = 175, - TypeLiteral = 176, - ArrayType = 177, - TupleType = 178, - OptionalType = 179, - RestType = 180, - UnionType = 181, - IntersectionType = 182, - ConditionalType = 183, - InferType = 184, - ParenthesizedType = 185, - ThisType = 186, - TypeOperator = 187, - IndexedAccessType = 188, - MappedType = 189, - LiteralType = 190, - NamedTupleMember = 191, - ImportType = 192, - ObjectBindingPattern = 193, - ArrayBindingPattern = 194, - BindingElement = 195, - ArrayLiteralExpression = 196, - ObjectLiteralExpression = 197, - PropertyAccessExpression = 198, - ElementAccessExpression = 199, - CallExpression = 200, - NewExpression = 201, - TaggedTemplateExpression = 202, - TypeAssertionExpression = 203, - ParenthesizedExpression = 204, - FunctionExpression = 205, - ArrowFunction = 206, - DeleteExpression = 207, - TypeOfExpression = 208, - VoidExpression = 209, - AwaitExpression = 210, - PrefixUnaryExpression = 211, - PostfixUnaryExpression = 212, - BinaryExpression = 213, - ConditionalExpression = 214, - TemplateExpression = 215, - YieldExpression = 216, - SpreadElement = 217, - ClassExpression = 218, - OmittedExpression = 219, - ExpressionWithTypeArguments = 220, - AsExpression = 221, - NonNullExpression = 222, - MetaProperty = 223, - SyntheticExpression = 224, - TemplateSpan = 225, - SemicolonClassElement = 226, - Block = 227, - EmptyStatement = 228, - VariableStatement = 229, - ExpressionStatement = 230, - IfStatement = 231, - DoStatement = 232, - WhileStatement = 233, - ForStatement = 234, - ForInStatement = 235, - ForOfStatement = 236, - ContinueStatement = 237, - BreakStatement = 238, - ReturnStatement = 239, - WithStatement = 240, - SwitchStatement = 241, - LabeledStatement = 242, - ThrowStatement = 243, - TryStatement = 244, - DebuggerStatement = 245, - VariableDeclaration = 246, - VariableDeclarationList = 247, - FunctionDeclaration = 248, - ClassDeclaration = 249, - InterfaceDeclaration = 250, - TypeAliasDeclaration = 251, - EnumDeclaration = 252, - ModuleDeclaration = 253, - ModuleBlock = 254, - CaseBlock = 255, - NamespaceExportDeclaration = 256, - ImportEqualsDeclaration = 257, - ImportDeclaration = 258, - ImportClause = 259, - NamespaceImport = 260, - NamedImports = 261, - ImportSpecifier = 262, - ExportAssignment = 263, - ExportDeclaration = 264, - NamedExports = 265, - NamespaceExport = 266, - ExportSpecifier = 267, - MissingDeclaration = 268, - ExternalModuleReference = 269, - JsxElement = 270, - JsxSelfClosingElement = 271, - JsxOpeningElement = 272, - JsxClosingElement = 273, - JsxFragment = 274, - JsxOpeningFragment = 275, - JsxClosingFragment = 276, - JsxAttribute = 277, - JsxAttributes = 278, - JsxSpreadAttribute = 279, - JsxExpression = 280, - CaseClause = 281, - DefaultClause = 282, - HeritageClause = 283, - CatchClause = 284, - PropertyAssignment = 285, - ShorthandPropertyAssignment = 286, - SpreadAssignment = 287, - EnumMember = 288, - UnparsedPrologue = 289, - UnparsedPrepend = 290, - UnparsedText = 291, - UnparsedInternalText = 292, - UnparsedSyntheticReference = 293, - SourceFile = 294, - Bundle = 295, - UnparsedSource = 296, - InputFiles = 297, - JSDocTypeExpression = 298, - JSDocAllType = 299, - JSDocUnknownType = 300, - JSDocNullableType = 301, - JSDocNonNullableType = 302, - JSDocOptionalType = 303, - JSDocFunctionType = 304, - JSDocVariadicType = 305, - JSDocNamepathType = 306, - JSDocComment = 307, - JSDocTypeLiteral = 308, - JSDocSignature = 309, - JSDocTag = 310, - JSDocAugmentsTag = 311, - JSDocImplementsTag = 312, - JSDocAuthorTag = 313, - JSDocDeprecatedTag = 314, - JSDocClassTag = 315, - JSDocPublicTag = 316, - JSDocPrivateTag = 317, - JSDocProtectedTag = 318, - JSDocReadonlyTag = 319, - JSDocCallbackTag = 320, - JSDocEnumTag = 321, - JSDocParameterTag = 322, - JSDocReturnTag = 323, - JSDocThisTag = 324, - JSDocTypeTag = 325, - JSDocTemplateTag = 326, - JSDocTypedefTag = 327, - JSDocPropertyTag = 328, - SyntaxList = 329, - NotEmittedStatement = 330, - PartiallyEmittedExpression = 331, - CommaListExpression = 332, - MergeDeclarationMarker = 333, - EndOfDeclarationMarker = 334, - SyntheticReferenceExpression = 335, - Count = 336, + OverrideKeyword = 155, + OfKeyword = 156, + QualifiedName = 157, + ComputedPropertyName = 158, + TypeParameter = 159, + Parameter = 160, + Decorator = 161, + PropertySignature = 162, + PropertyDeclaration = 163, + MethodSignature = 164, + MethodDeclaration = 165, + Constructor = 166, + GetAccessor = 167, + SetAccessor = 168, + CallSignature = 169, + ConstructSignature = 170, + IndexSignature = 171, + TypePredicate = 172, + TypeReference = 173, + FunctionType = 174, + ConstructorType = 175, + TypeQuery = 176, + TypeLiteral = 177, + ArrayType = 178, + TupleType = 179, + OptionalType = 180, + RestType = 181, + UnionType = 182, + IntersectionType = 183, + ConditionalType = 184, + InferType = 185, + ParenthesizedType = 186, + ThisType = 187, + TypeOperator = 188, + IndexedAccessType = 189, + MappedType = 190, + LiteralType = 191, + NamedTupleMember = 192, + ImportType = 193, + ObjectBindingPattern = 194, + ArrayBindingPattern = 195, + BindingElement = 196, + ArrayLiteralExpression = 197, + ObjectLiteralExpression = 198, + PropertyAccessExpression = 199, + ElementAccessExpression = 200, + CallExpression = 201, + NewExpression = 202, + TaggedTemplateExpression = 203, + TypeAssertionExpression = 204, + ParenthesizedExpression = 205, + FunctionExpression = 206, + ArrowFunction = 207, + DeleteExpression = 208, + TypeOfExpression = 209, + VoidExpression = 210, + AwaitExpression = 211, + PrefixUnaryExpression = 212, + PostfixUnaryExpression = 213, + BinaryExpression = 214, + ConditionalExpression = 215, + TemplateExpression = 216, + YieldExpression = 217, + SpreadElement = 218, + ClassExpression = 219, + OmittedExpression = 220, + ExpressionWithTypeArguments = 221, + AsExpression = 222, + NonNullExpression = 223, + MetaProperty = 224, + SyntheticExpression = 225, + TemplateSpan = 226, + SemicolonClassElement = 227, + Block = 228, + EmptyStatement = 229, + VariableStatement = 230, + ExpressionStatement = 231, + IfStatement = 232, + DoStatement = 233, + WhileStatement = 234, + ForStatement = 235, + ForInStatement = 236, + ForOfStatement = 237, + ContinueStatement = 238, + BreakStatement = 239, + ReturnStatement = 240, + WithStatement = 241, + SwitchStatement = 242, + LabeledStatement = 243, + ThrowStatement = 244, + TryStatement = 245, + DebuggerStatement = 246, + VariableDeclaration = 247, + VariableDeclarationList = 248, + FunctionDeclaration = 249, + ClassDeclaration = 250, + InterfaceDeclaration = 251, + TypeAliasDeclaration = 252, + EnumDeclaration = 253, + ModuleDeclaration = 254, + ModuleBlock = 255, + CaseBlock = 256, + NamespaceExportDeclaration = 257, + ImportEqualsDeclaration = 258, + ImportDeclaration = 259, + ImportClause = 260, + NamespaceImport = 261, + NamedImports = 262, + ImportSpecifier = 263, + ExportAssignment = 264, + ExportDeclaration = 265, + NamedExports = 266, + NamespaceExport = 267, + ExportSpecifier = 268, + MissingDeclaration = 269, + ExternalModuleReference = 270, + JsxElement = 271, + JsxSelfClosingElement = 272, + JsxOpeningElement = 273, + JsxClosingElement = 274, + JsxFragment = 275, + JsxOpeningFragment = 276, + JsxClosingFragment = 277, + JsxAttribute = 278, + JsxAttributes = 279, + JsxSpreadAttribute = 280, + JsxExpression = 281, + CaseClause = 282, + DefaultClause = 283, + HeritageClause = 284, + CatchClause = 285, + PropertyAssignment = 286, + ShorthandPropertyAssignment = 287, + SpreadAssignment = 288, + EnumMember = 289, + UnparsedPrologue = 290, + UnparsedPrepend = 291, + UnparsedText = 292, + UnparsedInternalText = 293, + UnparsedSyntheticReference = 294, + SourceFile = 295, + Bundle = 296, + UnparsedSource = 297, + InputFiles = 298, + JSDocTypeExpression = 299, + JSDocAllType = 300, + JSDocUnknownType = 301, + JSDocNullableType = 302, + JSDocNonNullableType = 303, + JSDocOptionalType = 304, + JSDocFunctionType = 305, + JSDocVariadicType = 306, + JSDocNamepathType = 307, + JSDocComment = 308, + JSDocTypeLiteral = 309, + JSDocSignature = 310, + JSDocTag = 311, + JSDocAugmentsTag = 312, + JSDocImplementsTag = 313, + JSDocAuthorTag = 314, + JSDocDeprecatedTag = 315, + JSDocClassTag = 316, + JSDocPublicTag = 317, + JSDocPrivateTag = 318, + JSDocProtectedTag = 319, + JSDocReadonlyTag = 320, + JSDocCallbackTag = 321, + JSDocEnumTag = 322, + JSDocParameterTag = 323, + JSDocReturnTag = 324, + JSDocThisTag = 325, + JSDocTypeTag = 326, + JSDocTemplateTag = 327, + JSDocTypedefTag = 328, + JSDocPropertyTag = 329, + SyntaxList = 330, + NotEmittedStatement = 331, + PartiallyEmittedExpression = 332, + CommaListExpression = 333, + MergeDeclarationMarker = 334, + EndOfDeclarationMarker = 335, + SyntheticReferenceExpression = 336, + Count = 337, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -448,15 +449,15 @@ declare namespace ts { FirstReservedWord = 80, LastReservedWord = 115, FirstKeyword = 80, - LastKeyword = 155, + LastKeyword = 156, FirstFutureReservedWord = 116, LastFutureReservedWord = 124, - FirstTypeNode = 171, - LastTypeNode = 192, + FirstTypeNode = 172, + LastTypeNode = 193, FirstPunctuation = 18, LastPunctuation = 77, FirstToken = 0, - LastToken = 155, + LastToken = 156, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -465,20 +466,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 77, - FirstStatement = 229, - LastStatement = 245, - FirstNode = 156, - FirstJSDocNode = 298, - LastJSDocNode = 328, - FirstJSDocTagNode = 310, - LastJSDocTagNode = 328, + FirstStatement = 230, + LastStatement = 246, + FirstNode = 157, + FirstJSDocNode = 299, + LastJSDocNode = 329, + FirstJSDocTagNode = 311, + LastJSDocTagNode = 329, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -528,6 +529,7 @@ declare namespace ts { Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, + Override = 16384, HasComputedFlags = 536870912, AccessibilityModifier = 28, ParameterPropertyModifier = 92, @@ -598,10 +600,11 @@ declare namespace ts { export type ProtectedKeyword = ModifierToken; export type PublicKeyword = ModifierToken; export type ReadonlyKeyword = ModifierToken; + export type OverrideKeyword = ModifierToken; export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; @@ -2801,6 +2804,7 @@ declare namespace ts { outFile?: string; paths?: MapLike; preserveConstEnums?: boolean; + pedanticOverride?: boolean; preserveSymlinks?: boolean; project?: string; reactNamespace?: string; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3f7f682342456..da1012a0553e4 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -259,188 +259,189 @@ declare namespace ts { FromKeyword = 152, GlobalKeyword = 153, BigIntKeyword = 154, - OfKeyword = 155, - QualifiedName = 156, - ComputedPropertyName = 157, - TypeParameter = 158, - Parameter = 159, - Decorator = 160, - PropertySignature = 161, - PropertyDeclaration = 162, - MethodSignature = 163, - MethodDeclaration = 164, - Constructor = 165, - GetAccessor = 166, - SetAccessor = 167, - CallSignature = 168, - ConstructSignature = 169, - IndexSignature = 170, - TypePredicate = 171, - TypeReference = 172, - FunctionType = 173, - ConstructorType = 174, - TypeQuery = 175, - TypeLiteral = 176, - ArrayType = 177, - TupleType = 178, - OptionalType = 179, - RestType = 180, - UnionType = 181, - IntersectionType = 182, - ConditionalType = 183, - InferType = 184, - ParenthesizedType = 185, - ThisType = 186, - TypeOperator = 187, - IndexedAccessType = 188, - MappedType = 189, - LiteralType = 190, - NamedTupleMember = 191, - ImportType = 192, - ObjectBindingPattern = 193, - ArrayBindingPattern = 194, - BindingElement = 195, - ArrayLiteralExpression = 196, - ObjectLiteralExpression = 197, - PropertyAccessExpression = 198, - ElementAccessExpression = 199, - CallExpression = 200, - NewExpression = 201, - TaggedTemplateExpression = 202, - TypeAssertionExpression = 203, - ParenthesizedExpression = 204, - FunctionExpression = 205, - ArrowFunction = 206, - DeleteExpression = 207, - TypeOfExpression = 208, - VoidExpression = 209, - AwaitExpression = 210, - PrefixUnaryExpression = 211, - PostfixUnaryExpression = 212, - BinaryExpression = 213, - ConditionalExpression = 214, - TemplateExpression = 215, - YieldExpression = 216, - SpreadElement = 217, - ClassExpression = 218, - OmittedExpression = 219, - ExpressionWithTypeArguments = 220, - AsExpression = 221, - NonNullExpression = 222, - MetaProperty = 223, - SyntheticExpression = 224, - TemplateSpan = 225, - SemicolonClassElement = 226, - Block = 227, - EmptyStatement = 228, - VariableStatement = 229, - ExpressionStatement = 230, - IfStatement = 231, - DoStatement = 232, - WhileStatement = 233, - ForStatement = 234, - ForInStatement = 235, - ForOfStatement = 236, - ContinueStatement = 237, - BreakStatement = 238, - ReturnStatement = 239, - WithStatement = 240, - SwitchStatement = 241, - LabeledStatement = 242, - ThrowStatement = 243, - TryStatement = 244, - DebuggerStatement = 245, - VariableDeclaration = 246, - VariableDeclarationList = 247, - FunctionDeclaration = 248, - ClassDeclaration = 249, - InterfaceDeclaration = 250, - TypeAliasDeclaration = 251, - EnumDeclaration = 252, - ModuleDeclaration = 253, - ModuleBlock = 254, - CaseBlock = 255, - NamespaceExportDeclaration = 256, - ImportEqualsDeclaration = 257, - ImportDeclaration = 258, - ImportClause = 259, - NamespaceImport = 260, - NamedImports = 261, - ImportSpecifier = 262, - ExportAssignment = 263, - ExportDeclaration = 264, - NamedExports = 265, - NamespaceExport = 266, - ExportSpecifier = 267, - MissingDeclaration = 268, - ExternalModuleReference = 269, - JsxElement = 270, - JsxSelfClosingElement = 271, - JsxOpeningElement = 272, - JsxClosingElement = 273, - JsxFragment = 274, - JsxOpeningFragment = 275, - JsxClosingFragment = 276, - JsxAttribute = 277, - JsxAttributes = 278, - JsxSpreadAttribute = 279, - JsxExpression = 280, - CaseClause = 281, - DefaultClause = 282, - HeritageClause = 283, - CatchClause = 284, - PropertyAssignment = 285, - ShorthandPropertyAssignment = 286, - SpreadAssignment = 287, - EnumMember = 288, - UnparsedPrologue = 289, - UnparsedPrepend = 290, - UnparsedText = 291, - UnparsedInternalText = 292, - UnparsedSyntheticReference = 293, - SourceFile = 294, - Bundle = 295, - UnparsedSource = 296, - InputFiles = 297, - JSDocTypeExpression = 298, - JSDocAllType = 299, - JSDocUnknownType = 300, - JSDocNullableType = 301, - JSDocNonNullableType = 302, - JSDocOptionalType = 303, - JSDocFunctionType = 304, - JSDocVariadicType = 305, - JSDocNamepathType = 306, - JSDocComment = 307, - JSDocTypeLiteral = 308, - JSDocSignature = 309, - JSDocTag = 310, - JSDocAugmentsTag = 311, - JSDocImplementsTag = 312, - JSDocAuthorTag = 313, - JSDocDeprecatedTag = 314, - JSDocClassTag = 315, - JSDocPublicTag = 316, - JSDocPrivateTag = 317, - JSDocProtectedTag = 318, - JSDocReadonlyTag = 319, - JSDocCallbackTag = 320, - JSDocEnumTag = 321, - JSDocParameterTag = 322, - JSDocReturnTag = 323, - JSDocThisTag = 324, - JSDocTypeTag = 325, - JSDocTemplateTag = 326, - JSDocTypedefTag = 327, - JSDocPropertyTag = 328, - SyntaxList = 329, - NotEmittedStatement = 330, - PartiallyEmittedExpression = 331, - CommaListExpression = 332, - MergeDeclarationMarker = 333, - EndOfDeclarationMarker = 334, - SyntheticReferenceExpression = 335, - Count = 336, + OverrideKeyword = 155, + OfKeyword = 156, + QualifiedName = 157, + ComputedPropertyName = 158, + TypeParameter = 159, + Parameter = 160, + Decorator = 161, + PropertySignature = 162, + PropertyDeclaration = 163, + MethodSignature = 164, + MethodDeclaration = 165, + Constructor = 166, + GetAccessor = 167, + SetAccessor = 168, + CallSignature = 169, + ConstructSignature = 170, + IndexSignature = 171, + TypePredicate = 172, + TypeReference = 173, + FunctionType = 174, + ConstructorType = 175, + TypeQuery = 176, + TypeLiteral = 177, + ArrayType = 178, + TupleType = 179, + OptionalType = 180, + RestType = 181, + UnionType = 182, + IntersectionType = 183, + ConditionalType = 184, + InferType = 185, + ParenthesizedType = 186, + ThisType = 187, + TypeOperator = 188, + IndexedAccessType = 189, + MappedType = 190, + LiteralType = 191, + NamedTupleMember = 192, + ImportType = 193, + ObjectBindingPattern = 194, + ArrayBindingPattern = 195, + BindingElement = 196, + ArrayLiteralExpression = 197, + ObjectLiteralExpression = 198, + PropertyAccessExpression = 199, + ElementAccessExpression = 200, + CallExpression = 201, + NewExpression = 202, + TaggedTemplateExpression = 203, + TypeAssertionExpression = 204, + ParenthesizedExpression = 205, + FunctionExpression = 206, + ArrowFunction = 207, + DeleteExpression = 208, + TypeOfExpression = 209, + VoidExpression = 210, + AwaitExpression = 211, + PrefixUnaryExpression = 212, + PostfixUnaryExpression = 213, + BinaryExpression = 214, + ConditionalExpression = 215, + TemplateExpression = 216, + YieldExpression = 217, + SpreadElement = 218, + ClassExpression = 219, + OmittedExpression = 220, + ExpressionWithTypeArguments = 221, + AsExpression = 222, + NonNullExpression = 223, + MetaProperty = 224, + SyntheticExpression = 225, + TemplateSpan = 226, + SemicolonClassElement = 227, + Block = 228, + EmptyStatement = 229, + VariableStatement = 230, + ExpressionStatement = 231, + IfStatement = 232, + DoStatement = 233, + WhileStatement = 234, + ForStatement = 235, + ForInStatement = 236, + ForOfStatement = 237, + ContinueStatement = 238, + BreakStatement = 239, + ReturnStatement = 240, + WithStatement = 241, + SwitchStatement = 242, + LabeledStatement = 243, + ThrowStatement = 244, + TryStatement = 245, + DebuggerStatement = 246, + VariableDeclaration = 247, + VariableDeclarationList = 248, + FunctionDeclaration = 249, + ClassDeclaration = 250, + InterfaceDeclaration = 251, + TypeAliasDeclaration = 252, + EnumDeclaration = 253, + ModuleDeclaration = 254, + ModuleBlock = 255, + CaseBlock = 256, + NamespaceExportDeclaration = 257, + ImportEqualsDeclaration = 258, + ImportDeclaration = 259, + ImportClause = 260, + NamespaceImport = 261, + NamedImports = 262, + ImportSpecifier = 263, + ExportAssignment = 264, + ExportDeclaration = 265, + NamedExports = 266, + NamespaceExport = 267, + ExportSpecifier = 268, + MissingDeclaration = 269, + ExternalModuleReference = 270, + JsxElement = 271, + JsxSelfClosingElement = 272, + JsxOpeningElement = 273, + JsxClosingElement = 274, + JsxFragment = 275, + JsxOpeningFragment = 276, + JsxClosingFragment = 277, + JsxAttribute = 278, + JsxAttributes = 279, + JsxSpreadAttribute = 280, + JsxExpression = 281, + CaseClause = 282, + DefaultClause = 283, + HeritageClause = 284, + CatchClause = 285, + PropertyAssignment = 286, + ShorthandPropertyAssignment = 287, + SpreadAssignment = 288, + EnumMember = 289, + UnparsedPrologue = 290, + UnparsedPrepend = 291, + UnparsedText = 292, + UnparsedInternalText = 293, + UnparsedSyntheticReference = 294, + SourceFile = 295, + Bundle = 296, + UnparsedSource = 297, + InputFiles = 298, + JSDocTypeExpression = 299, + JSDocAllType = 300, + JSDocUnknownType = 301, + JSDocNullableType = 302, + JSDocNonNullableType = 303, + JSDocOptionalType = 304, + JSDocFunctionType = 305, + JSDocVariadicType = 306, + JSDocNamepathType = 307, + JSDocComment = 308, + JSDocTypeLiteral = 309, + JSDocSignature = 310, + JSDocTag = 311, + JSDocAugmentsTag = 312, + JSDocImplementsTag = 313, + JSDocAuthorTag = 314, + JSDocDeprecatedTag = 315, + JSDocClassTag = 316, + JSDocPublicTag = 317, + JSDocPrivateTag = 318, + JSDocProtectedTag = 319, + JSDocReadonlyTag = 320, + JSDocCallbackTag = 321, + JSDocEnumTag = 322, + JSDocParameterTag = 323, + JSDocReturnTag = 324, + JSDocThisTag = 325, + JSDocTypeTag = 326, + JSDocTemplateTag = 327, + JSDocTypedefTag = 328, + JSDocPropertyTag = 329, + SyntaxList = 330, + NotEmittedStatement = 331, + PartiallyEmittedExpression = 332, + CommaListExpression = 333, + MergeDeclarationMarker = 334, + EndOfDeclarationMarker = 335, + SyntheticReferenceExpression = 336, + Count = 337, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -448,15 +449,15 @@ declare namespace ts { FirstReservedWord = 80, LastReservedWord = 115, FirstKeyword = 80, - LastKeyword = 155, + LastKeyword = 156, FirstFutureReservedWord = 116, LastFutureReservedWord = 124, - FirstTypeNode = 171, - LastTypeNode = 192, + FirstTypeNode = 172, + LastTypeNode = 193, FirstPunctuation = 18, LastPunctuation = 77, FirstToken = 0, - LastToken = 155, + LastToken = 156, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -465,20 +466,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 77, - FirstStatement = 229, - LastStatement = 245, - FirstNode = 156, - FirstJSDocNode = 298, - LastJSDocNode = 328, - FirstJSDocTagNode = 310, - LastJSDocTagNode = 328, + FirstStatement = 230, + LastStatement = 246, + FirstNode = 157, + FirstJSDocNode = 299, + LastJSDocNode = 329, + FirstJSDocTagNode = 311, + LastJSDocTagNode = 329, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -528,6 +529,7 @@ declare namespace ts { Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, + Override = 16384, HasComputedFlags = 536870912, AccessibilityModifier = 28, ParameterPropertyModifier = 92, @@ -598,10 +600,11 @@ declare namespace ts { export type ProtectedKeyword = ModifierToken; export type PublicKeyword = ModifierToken; export type ReadonlyKeyword = ModifierToken; + export type OverrideKeyword = ModifierToken; export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; @@ -2801,6 +2804,7 @@ declare namespace ts { outFile?: string; paths?: MapLike; preserveConstEnums?: boolean; + pedanticOverride?: boolean; preserveSymlinks?: boolean; project?: string; reactNamespace?: string; diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/pedanticOverride/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/pedanticOverride/tsconfig.json new file mode 100644 index 0000000000000..776ea7cf4457a --- /dev/null +++ b/tests/baselines/reference/showConfig/Shows tsconfig for single option/pedanticOverride/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "pedanticOverride": true + } +} diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index c9f603c2199ec..654c8f6cbfb2d 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index 83893736515ea..a3d2a8b944cee 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index f2ff8ef9f0053..b82f10f9debfd 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 286219dae6e96..3ea917ab123b5 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index 0ec33da9842fc..b1da31b267295 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index ea8f60ca0cf8c..034bb16cd7a87 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index c9f603c2199ec..654c8f6cbfb2d 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 7add8d543f8c8..53bfbf81e6448 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 29a0374fa2688..c985cacfdcb01 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -39,6 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js index 68e55e69a289b..749094c452430 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js @@ -60,6 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js index 4f58a6cb9209c..22d44534d98e8 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js @@ -60,6 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js index c0390a97918af..7ba10b2b850f1 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js @@ -60,6 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js index b04d25e8fefc4..9a525da094185 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js @@ -60,6 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js index a95b9006f3cbf..aba85addbbb05 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js @@ -60,6 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js index 3b98f66e02fde..1401615fe779e 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js @@ -60,6 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "pedanticOverride": true, /* Required override modifier in class element */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ From 6401e1ad07c63b3708fc47eef5a152f89013e6c3 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 20 Jul 2020 20:41:03 +0800 Subject: [PATCH 07/61] add abstract abd declare method --- tests/baselines/reference/override1.js | 39 ++++++++ .../baselines/reference/override2.errors.txt | 32 +++++++ tests/baselines/reference/override2.js | 95 +++++++++++++++++++ tests/baselines/reference/override2.symbols | 52 ++++++++++ tests/baselines/reference/override2.types | 52 ++++++++++ .../baselines/reference/override3.errors.txt | 26 +++++ tests/baselines/reference/override3.js | 73 ++++++++++++++ tests/baselines/reference/override3.symbols | 44 +++++++++ tests/baselines/reference/override3.types | 44 +++++++++ tests/cases/conformance/override/override1.ts | 1 + tests/cases/conformance/override/override2.ts | 25 +++++ tests/cases/conformance/override/override3.ts | 21 ++++ 12 files changed, 504 insertions(+) create mode 100644 tests/baselines/reference/override2.errors.txt create mode 100644 tests/baselines/reference/override2.js create mode 100644 tests/baselines/reference/override2.symbols create mode 100644 tests/baselines/reference/override2.types create mode 100644 tests/baselines/reference/override3.errors.txt create mode 100644 tests/baselines/reference/override3.js create mode 100644 tests/baselines/reference/override3.symbols create mode 100644 tests/baselines/reference/override3.types create mode 100644 tests/cases/conformance/override/override2.ts create mode 100644 tests/cases/conformance/override/override3.ts diff --git a/tests/baselines/reference/override1.js b/tests/baselines/reference/override1.js index d7c8d1af5aeb1..cf51e4cd0c8fa 100644 --- a/tests/baselines/reference/override1.js +++ b/tests/baselines/reference/override1.js @@ -118,3 +118,42 @@ function ff() { return class_3; }()); } + + +//// [override1.d.ts] +declare class B { + foo(v: string): void; + fooo(v: string): void; +} +declare class D extends B { + foo(v: string): void; + fooo(v: string): void; + bar(v: string): void; +} +declare class C { + foo(v: string): void; +} +declare function f(): { + new (): { + foo(v: string): void; + fooo(v: string): void; + bar(v: string): void; + }; +}; +declare const E_base: { + new (): { + foo(): void; + bar(): void; + }; +}; +declare class E extends E_base { + foo(): void; + bar(): void; + baz(): void; + bazz(): void; +} +declare function ff(): { + new (): { + foo(): void; + }; +}; diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt new file mode 100644 index 0000000000000..7687558c24a4f --- /dev/null +++ b/tests/baselines/reference/override2.errors.txt @@ -0,0 +1,32 @@ +tests/cases/conformance/override/override2.ts(12,14): error TS4113: Method must have override modifier because it's override the base class 'AB'. +tests/cases/conformance/override/override2.ts(17,14): error TS4113: Method must have override modifier because it's override the base class 'AB'. + + +==== tests/cases/conformance/override/override2.ts (2 errors) ==== + abstract class AB { + abstract foo(v: string): void; + + abstract bar(v: string): void + } + + abstract class AD1 extends AB { + + } + + abstract class AD2 extends AB { + abstract foo(v: ''): void // need override? + ~~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'AB'. + } + + abstract class AD3 extends AB { + override foo(v: ''): void { } // need override? + abstract bar(): void; + ~~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'AB'. + } + + class D4 extends AB { + override foo(v: ''): void {} + override bar(v: ''): void {} + } \ No newline at end of file diff --git a/tests/baselines/reference/override2.js b/tests/baselines/reference/override2.js new file mode 100644 index 0000000000000..0efebd845be22 --- /dev/null +++ b/tests/baselines/reference/override2.js @@ -0,0 +1,95 @@ +//// [override2.ts] +abstract class AB { + abstract foo(v: string): void; + + abstract bar(v: string): void +} + +abstract class AD1 extends AB { + +} + +abstract class AD2 extends AB { + abstract foo(v: ''): void // need override? +} + +abstract class AD3 extends AB { + override foo(v: ''): void { } // need override? + abstract bar(): void; +} + +class D4 extends AB { + override foo(v: ''): void {} + override bar(v: ''): void {} +} + +//// [override2.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var AB = /** @class */ (function () { + function AB() { + } + return AB; +}()); +var AD1 = /** @class */ (function (_super) { + __extends(AD1, _super); + function AD1() { + return _super !== null && _super.apply(this, arguments) || this; + } + return AD1; +}(AB)); +var AD2 = /** @class */ (function (_super) { + __extends(AD2, _super); + function AD2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return AD2; +}(AB)); +var AD3 = /** @class */ (function (_super) { + __extends(AD3, _super); + function AD3() { + return _super !== null && _super.apply(this, arguments) || this; + } + AD3.prototype.foo = function (v) { }; // need override? + return AD3; +}(AB)); +var D4 = /** @class */ (function (_super) { + __extends(D4, _super); + function D4() { + return _super !== null && _super.apply(this, arguments) || this; + } + D4.prototype.foo = function (v) { }; + D4.prototype.bar = function (v) { }; + return D4; +}(AB)); + + +//// [override2.d.ts] +declare abstract class AB { + abstract foo(v: string): void; + abstract bar(v: string): void; +} +declare abstract class AD1 extends AB { +} +declare abstract class AD2 extends AB { + abstract foo(v: ''): void; +} +declare abstract class AD3 extends AB { + foo(v: ''): void; + abstract bar(): void; +} +declare class D4 extends AB { + foo(v: ''): void; + bar(v: ''): void; +} diff --git a/tests/baselines/reference/override2.symbols b/tests/baselines/reference/override2.symbols new file mode 100644 index 0000000000000..4b12174e133f5 --- /dev/null +++ b/tests/baselines/reference/override2.symbols @@ -0,0 +1,52 @@ +=== tests/cases/conformance/override/override2.ts === +abstract class AB { +>AB : Symbol(AB, Decl(override2.ts, 0, 0)) + + abstract foo(v: string): void; +>foo : Symbol(AB.foo, Decl(override2.ts, 0, 19)) +>v : Symbol(v, Decl(override2.ts, 1, 17)) + + abstract bar(v: string): void +>bar : Symbol(AB.bar, Decl(override2.ts, 1, 34)) +>v : Symbol(v, Decl(override2.ts, 3, 17)) +} + +abstract class AD1 extends AB { +>AD1 : Symbol(AD1, Decl(override2.ts, 4, 1)) +>AB : Symbol(AB, Decl(override2.ts, 0, 0)) + +} + +abstract class AD2 extends AB { +>AD2 : Symbol(AD2, Decl(override2.ts, 8, 1)) +>AB : Symbol(AB, Decl(override2.ts, 0, 0)) + + abstract foo(v: ''): void // need override? +>foo : Symbol(AD2.foo, Decl(override2.ts, 10, 31)) +>v : Symbol(v, Decl(override2.ts, 11, 17)) +} + +abstract class AD3 extends AB { +>AD3 : Symbol(AD3, Decl(override2.ts, 12, 1)) +>AB : Symbol(AB, Decl(override2.ts, 0, 0)) + + override foo(v: ''): void { } // need override? +>foo : Symbol(AD3.foo, Decl(override2.ts, 14, 31)) +>v : Symbol(v, Decl(override2.ts, 15, 17)) + + abstract bar(): void; +>bar : Symbol(AD3.bar, Decl(override2.ts, 15, 33)) +} + +class D4 extends AB { +>D4 : Symbol(D4, Decl(override2.ts, 17, 1)) +>AB : Symbol(AB, Decl(override2.ts, 0, 0)) + + override foo(v: ''): void {} +>foo : Symbol(D4.foo, Decl(override2.ts, 19, 21)) +>v : Symbol(v, Decl(override2.ts, 20, 17)) + + override bar(v: ''): void {} +>bar : Symbol(D4.bar, Decl(override2.ts, 20, 32)) +>v : Symbol(v, Decl(override2.ts, 21, 17)) +} diff --git a/tests/baselines/reference/override2.types b/tests/baselines/reference/override2.types new file mode 100644 index 0000000000000..86acdd10c3dca --- /dev/null +++ b/tests/baselines/reference/override2.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/override/override2.ts === +abstract class AB { +>AB : AB + + abstract foo(v: string): void; +>foo : (v: string) => void +>v : string + + abstract bar(v: string): void +>bar : (v: string) => void +>v : string +} + +abstract class AD1 extends AB { +>AD1 : AD1 +>AB : AB + +} + +abstract class AD2 extends AB { +>AD2 : AD2 +>AB : AB + + abstract foo(v: ''): void // need override? +>foo : (v: '') => void +>v : "" +} + +abstract class AD3 extends AB { +>AD3 : AD3 +>AB : AB + + override foo(v: ''): void { } // need override? +>foo : (v: '') => void +>v : "" + + abstract bar(): void; +>bar : () => void +} + +class D4 extends AB { +>D4 : D4 +>AB : AB + + override foo(v: ''): void {} +>foo : (v: '') => void +>v : "" + + override bar(v: ''): void {} +>bar : (v: '') => void +>v : "" +} diff --git a/tests/baselines/reference/override3.errors.txt b/tests/baselines/reference/override3.errors.txt new file mode 100644 index 0000000000000..32e1fbcfe858b --- /dev/null +++ b/tests/baselines/reference/override3.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/override/override3.ts(7,5): error TS4113: Method must have override modifier because it's override the base class 'B'. + + +==== tests/cases/conformance/override/override3.ts (1 errors) ==== + declare class B { + foo(): void + bar(): void + } + + declare class D extends B { + foo (): void; + ~~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. + override bar (): void; + } + + class DB extends B { + override foo(): void {} + override bar(): void {} + } + + class DD extends D { + override foo(): void {} + override bar(): void {} + } + \ No newline at end of file diff --git a/tests/baselines/reference/override3.js b/tests/baselines/reference/override3.js new file mode 100644 index 0000000000000..0ff69a00f259e --- /dev/null +++ b/tests/baselines/reference/override3.js @@ -0,0 +1,73 @@ +//// [override3.ts] +declare class B { + foo(): void + bar(): void +} + +declare class D extends B { + foo (): void; + override bar (): void; +} + +class DB extends B { + override foo(): void {} + override bar(): void {} +} + +class DD extends D { + override foo(): void {} + override bar(): void {} +} + + +//// [override3.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var DB = /** @class */ (function (_super) { + __extends(DB, _super); + function DB() { + return _super !== null && _super.apply(this, arguments) || this; + } + DB.prototype.foo = function () { }; + DB.prototype.bar = function () { }; + return DB; +}(B)); +var DD = /** @class */ (function (_super) { + __extends(DD, _super); + function DD() { + return _super !== null && _super.apply(this, arguments) || this; + } + DD.prototype.foo = function () { }; + DD.prototype.bar = function () { }; + return DD; +}(D)); + + +//// [override3.d.ts] +declare class B { + foo(): void; + bar(): void; +} +declare class D extends B { + foo(): void; + bar(): void; +} +declare class DB extends B { + foo(): void; + bar(): void; +} +declare class DD extends D { + foo(): void; + bar(): void; +} diff --git a/tests/baselines/reference/override3.symbols b/tests/baselines/reference/override3.symbols new file mode 100644 index 0000000000000..ed75ec1bbb568 --- /dev/null +++ b/tests/baselines/reference/override3.symbols @@ -0,0 +1,44 @@ +=== tests/cases/conformance/override/override3.ts === +declare class B { +>B : Symbol(B, Decl(override3.ts, 0, 0)) + + foo(): void +>foo : Symbol(B.foo, Decl(override3.ts, 0, 17)) + + bar(): void +>bar : Symbol(B.bar, Decl(override3.ts, 1, 15)) +} + +declare class D extends B { +>D : Symbol(D, Decl(override3.ts, 3, 1)) +>B : Symbol(B, Decl(override3.ts, 0, 0)) + + foo (): void; +>foo : Symbol(D.foo, Decl(override3.ts, 5, 27)) + + override bar (): void; +>bar : Symbol(D.bar, Decl(override3.ts, 6, 17)) +} + +class DB extends B { +>DB : Symbol(DB, Decl(override3.ts, 8, 1)) +>B : Symbol(B, Decl(override3.ts, 0, 0)) + + override foo(): void {} +>foo : Symbol(DB.foo, Decl(override3.ts, 10, 20)) + + override bar(): void {} +>bar : Symbol(DB.bar, Decl(override3.ts, 11, 27)) +} + +class DD extends D { +>DD : Symbol(DD, Decl(override3.ts, 13, 1)) +>D : Symbol(D, Decl(override3.ts, 3, 1)) + + override foo(): void {} +>foo : Symbol(DD.foo, Decl(override3.ts, 15, 20)) + + override bar(): void {} +>bar : Symbol(DD.bar, Decl(override3.ts, 16, 27)) +} + diff --git a/tests/baselines/reference/override3.types b/tests/baselines/reference/override3.types new file mode 100644 index 0000000000000..c6a7791197c8e --- /dev/null +++ b/tests/baselines/reference/override3.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/override/override3.ts === +declare class B { +>B : B + + foo(): void +>foo : () => void + + bar(): void +>bar : () => void +} + +declare class D extends B { +>D : D +>B : B + + foo (): void; +>foo : () => void + + override bar (): void; +>bar : () => void +} + +class DB extends B { +>DB : DB +>B : B + + override foo(): void {} +>foo : () => void + + override bar(): void {} +>bar : () => void +} + +class DD extends D { +>DD : DD +>D : D + + override foo(): void {} +>foo : () => void + + override bar(): void {} +>bar : () => void +} + diff --git a/tests/cases/conformance/override/override1.ts b/tests/cases/conformance/override/override1.ts index 9e7e18083591d..1c2a8e3ded07f 100644 --- a/tests/cases/conformance/override/override1.ts +++ b/tests/cases/conformance/override/override1.ts @@ -1,3 +1,4 @@ +// @declaration: true // @pedanticOverride: true class B { foo (v: string) {} diff --git a/tests/cases/conformance/override/override2.ts b/tests/cases/conformance/override/override2.ts new file mode 100644 index 0000000000000..5c9a3b896b9be --- /dev/null +++ b/tests/cases/conformance/override/override2.ts @@ -0,0 +1,25 @@ +// @declaration: true +// @pedanticOverride: true +abstract class AB { + abstract foo(v: string): void; + + abstract bar(v: string): void +} + +abstract class AD1 extends AB { + +} + +abstract class AD2 extends AB { + abstract foo(v: ''): void // need override? +} + +abstract class AD3 extends AB { + override foo(v: ''): void { } // need override? + abstract bar(): void; +} + +class D4 extends AB { + override foo(v: ''): void {} + override bar(v: ''): void {} +} \ No newline at end of file diff --git a/tests/cases/conformance/override/override3.ts b/tests/cases/conformance/override/override3.ts new file mode 100644 index 0000000000000..82a4b81605da9 --- /dev/null +++ b/tests/cases/conformance/override/override3.ts @@ -0,0 +1,21 @@ +// @declaration: true +// @pedanticOverride: true +declare class B { + foo(): void + bar(): void +} + +declare class D extends B { + foo (): void; + override bar (): void; +} + +class DB extends B { + override foo(): void {} + override bar(): void {} +} + +class DD extends D { + override foo(): void {} + override bar(): void {} +} From be0036317df9d190ad5e329833e2ca1d4ecc401b Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 20 Jul 2020 20:47:40 +0800 Subject: [PATCH 08/61] add override in declaration --- src/compiler/factory/nodeFactory.ts | 1 + src/compiler/types.ts | 2 +- tests/baselines/reference/override1.js | 10 +++++----- tests/baselines/reference/override2.js | 6 +++--- tests/baselines/reference/override3.js | 10 +++++----- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index a9679f453fe43..4281ae063b15f 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1025,6 +1025,7 @@ namespace ts { if (flags & ModifierFlags.Static) { result.push(createModifier(SyntaxKind.StaticKeyword)); } if (flags & ModifierFlags.Readonly) { result.push(createModifier(SyntaxKind.ReadonlyKeyword)); } if (flags & ModifierFlags.Async) { result.push(createModifier(SyntaxKind.AsyncKeyword)); } + if (flags & ModifierFlags.Override) { result.push(createModifier(SyntaxKind.OverrideKeyword)); } return result; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 308a80b2cc895..4932352bbc558 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -802,7 +802,7 @@ namespace ts { TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const, ExportDefault = Export | Default, - All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Async | Default | Const | Deprecated + All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Async | Default | Const | Deprecated | Override } export const enum JsxFlags { diff --git a/tests/baselines/reference/override1.js b/tests/baselines/reference/override1.js index cf51e4cd0c8fa..a33e048984f8a 100644 --- a/tests/baselines/reference/override1.js +++ b/tests/baselines/reference/override1.js @@ -126,12 +126,12 @@ declare class B { fooo(v: string): void; } declare class D extends B { - foo(v: string): void; + override foo(v: string): void; fooo(v: string): void; - bar(v: string): void; + override bar(v: string): void; } declare class C { - foo(v: string): void; + override foo(v: string): void; } declare function f(): { new (): { @@ -147,10 +147,10 @@ declare const E_base: { }; }; declare class E extends E_base { - foo(): void; + override foo(): void; bar(): void; baz(): void; - bazz(): void; + override bazz(): void; } declare function ff(): { new (): { diff --git a/tests/baselines/reference/override2.js b/tests/baselines/reference/override2.js index 0efebd845be22..caf452683168b 100644 --- a/tests/baselines/reference/override2.js +++ b/tests/baselines/reference/override2.js @@ -86,10 +86,10 @@ declare abstract class AD2 extends AB { abstract foo(v: ''): void; } declare abstract class AD3 extends AB { - foo(v: ''): void; + override foo(v: ''): void; abstract bar(): void; } declare class D4 extends AB { - foo(v: ''): void; - bar(v: ''): void; + override foo(v: ''): void; + override bar(v: ''): void; } diff --git a/tests/baselines/reference/override3.js b/tests/baselines/reference/override3.js index 0ff69a00f259e..751e347dfb700 100644 --- a/tests/baselines/reference/override3.js +++ b/tests/baselines/reference/override3.js @@ -61,13 +61,13 @@ declare class B { } declare class D extends B { foo(): void; - bar(): void; + override bar(): void; } declare class DB extends B { - foo(): void; - bar(): void; + override foo(): void; + override bar(): void; } declare class DD extends D { - foo(): void; - bar(): void; + override foo(): void; + override bar(): void; } From fbb6e281c85c55b977b313f3837b7a0a7334e49e Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 20 Jul 2020 21:01:29 +0800 Subject: [PATCH 09/61] accept baseline --- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2d4e005f10f42..d532649ceec64 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -536,7 +536,7 @@ declare namespace ts { NonPublicAccessibilityModifier = 24, TypeScriptModifier = 2270, ExportDefault = 513, - All = 11263 + All = 27647 } export enum JsxFlags { None = 0, diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index da1012a0553e4..1ecdd052365b3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -536,7 +536,7 @@ declare namespace ts { NonPublicAccessibilityModifier = 24, TypeScriptModifier = 2270, ExportDefault = 513, - All = 11263 + All = 27647 } export enum JsxFlags { None = 0, From 6014a3abecb321dbe2c639be3f077838983a3622 Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 21 Jul 2020 15:04:22 +0800 Subject: [PATCH 10/61] add property override --- .../baselines/reference/override4.errors.txt | 39 ++++++++ tests/baselines/reference/override4.js | 91 +++++++++++++++++++ tests/baselines/reference/override4.symbols | 61 +++++++++++++ tests/baselines/reference/override4.types | 65 +++++++++++++ tests/cases/conformance/override/override4.ts | 26 ++++++ 5 files changed, 282 insertions(+) create mode 100644 tests/baselines/reference/override4.errors.txt create mode 100644 tests/baselines/reference/override4.js create mode 100644 tests/baselines/reference/override4.symbols create mode 100644 tests/baselines/reference/override4.types create mode 100644 tests/cases/conformance/override/override4.ts diff --git a/tests/baselines/reference/override4.errors.txt b/tests/baselines/reference/override4.errors.txt new file mode 100644 index 0000000000000..ee598c967210f --- /dev/null +++ b/tests/baselines/reference/override4.errors.txt @@ -0,0 +1,39 @@ +tests/cases/conformance/override/override4.ts(11,5): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override4.ts(13,5): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override4.ts(17,5): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override4.ts(23,5): error TS4113: Method must have override modifier because it's override the base class 'B'. + + +==== tests/cases/conformance/override/override4.ts (4 errors) ==== + class B { + p1: number = 1; + p2: number = 1; + p3: () => void; + p4: () => void; + foo (v: string) {} + fooo (v: string) {} + } + + class D extends B { + p1: number = 2; + ~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. + override p2: number = 3; + p3: () => void; + ~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. + override p4: () => void; + override foo (v: string) {} + + fooo (v: string) {} + ~~~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. + + } + + class DD extends B { + override foo: () => void + fooo: () => void; + ~~~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. + } \ No newline at end of file diff --git a/tests/baselines/reference/override4.js b/tests/baselines/reference/override4.js new file mode 100644 index 0000000000000..ccb8726c82106 --- /dev/null +++ b/tests/baselines/reference/override4.js @@ -0,0 +1,91 @@ +//// [override4.ts] +class B { + p1: number = 1; + p2: number = 1; + p3: () => void; + p4: () => void; + foo (v: string) {} + fooo (v: string) {} +} + +class D extends B { + p1: number = 2; + override p2: number = 3; + p3: () => void; + override p4: () => void; + override foo (v: string) {} + + fooo (v: string) {} + +} + +class DD extends B { + override foo: () => void + fooo: () => void; +} + +//// [override4.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var B = /** @class */ (function () { + function B() { + this.p1 = 1; + this.p2 = 1; + } + B.prototype.foo = function (v) { }; + B.prototype.fooo = function (v) { }; + return B; +}()); +var D = /** @class */ (function (_super) { + __extends(D, _super); + function D() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.p1 = 2; + _this.p2 = 3; + return _this; + } + D.prototype.foo = function (v) { }; + D.prototype.fooo = function (v) { }; + return D; +}(B)); +var DD = /** @class */ (function (_super) { + __extends(DD, _super); + function DD() { + return _super !== null && _super.apply(this, arguments) || this; + } + return DD; +}(B)); + + +//// [override4.d.ts] +declare class B { + p1: number; + p2: number; + p3: () => void; + p4: () => void; + foo(v: string): void; + fooo(v: string): void; +} +declare class D extends B { + p1: number; + override p2: number; + p3: () => void; + override p4: () => void; + override foo(v: string): void; + fooo(v: string): void; +} +declare class DD extends B { + override foo: () => void; + fooo: () => void; +} diff --git a/tests/baselines/reference/override4.symbols b/tests/baselines/reference/override4.symbols new file mode 100644 index 0000000000000..f6926e47ffdde --- /dev/null +++ b/tests/baselines/reference/override4.symbols @@ -0,0 +1,61 @@ +=== tests/cases/conformance/override/override4.ts === +class B { +>B : Symbol(B, Decl(override4.ts, 0, 0)) + + p1: number = 1; +>p1 : Symbol(B.p1, Decl(override4.ts, 0, 9)) + + p2: number = 1; +>p2 : Symbol(B.p2, Decl(override4.ts, 1, 19)) + + p3: () => void; +>p3 : Symbol(B.p3, Decl(override4.ts, 2, 19)) + + p4: () => void; +>p4 : Symbol(B.p4, Decl(override4.ts, 3, 19)) + + foo (v: string) {} +>foo : Symbol(B.foo, Decl(override4.ts, 4, 19)) +>v : Symbol(v, Decl(override4.ts, 5, 9)) + + fooo (v: string) {} +>fooo : Symbol(B.fooo, Decl(override4.ts, 5, 22)) +>v : Symbol(v, Decl(override4.ts, 6, 10)) +} + +class D extends B { +>D : Symbol(D, Decl(override4.ts, 7, 1)) +>B : Symbol(B, Decl(override4.ts, 0, 0)) + + p1: number = 2; +>p1 : Symbol(D.p1, Decl(override4.ts, 9, 19)) + + override p2: number = 3; +>p2 : Symbol(D.p2, Decl(override4.ts, 10, 19)) + + p3: () => void; +>p3 : Symbol(D.p3, Decl(override4.ts, 11, 28)) + + override p4: () => void; +>p4 : Symbol(D.p4, Decl(override4.ts, 12, 19)) + + override foo (v: string) {} +>foo : Symbol(D.foo, Decl(override4.ts, 13, 28)) +>v : Symbol(v, Decl(override4.ts, 14, 18)) + + fooo (v: string) {} +>fooo : Symbol(D.fooo, Decl(override4.ts, 14, 31)) +>v : Symbol(v, Decl(override4.ts, 16, 10)) + +} + +class DD extends B { +>DD : Symbol(DD, Decl(override4.ts, 18, 1)) +>B : Symbol(B, Decl(override4.ts, 0, 0)) + + override foo: () => void +>foo : Symbol(DD.foo, Decl(override4.ts, 20, 20)) + + fooo: () => void; +>fooo : Symbol(DD.fooo, Decl(override4.ts, 21, 28)) +} diff --git a/tests/baselines/reference/override4.types b/tests/baselines/reference/override4.types new file mode 100644 index 0000000000000..7803126098b58 --- /dev/null +++ b/tests/baselines/reference/override4.types @@ -0,0 +1,65 @@ +=== tests/cases/conformance/override/override4.ts === +class B { +>B : B + + p1: number = 1; +>p1 : number +>1 : 1 + + p2: number = 1; +>p2 : number +>1 : 1 + + p3: () => void; +>p3 : () => void + + p4: () => void; +>p4 : () => void + + foo (v: string) {} +>foo : (v: string) => void +>v : string + + fooo (v: string) {} +>fooo : (v: string) => void +>v : string +} + +class D extends B { +>D : D +>B : B + + p1: number = 2; +>p1 : number +>2 : 2 + + override p2: number = 3; +>p2 : number +>3 : 3 + + p3: () => void; +>p3 : () => void + + override p4: () => void; +>p4 : () => void + + override foo (v: string) {} +>foo : (v: string) => void +>v : string + + fooo (v: string) {} +>fooo : (v: string) => void +>v : string + +} + +class DD extends B { +>DD : DD +>B : B + + override foo: () => void +>foo : () => void + + fooo: () => void; +>fooo : () => void +} diff --git a/tests/cases/conformance/override/override4.ts b/tests/cases/conformance/override/override4.ts new file mode 100644 index 0000000000000..be3e7ddb05e3a --- /dev/null +++ b/tests/cases/conformance/override/override4.ts @@ -0,0 +1,26 @@ +// @declaration: true +// @pedanticOverride: true +class B { + p1: number = 1; + p2: number = 1; + p3: () => void; + p4: () => void; + foo (v: string) {} + fooo (v: string) {} +} + +class D extends B { + p1: number = 2; + override p2: number = 3; + p3: () => void; + override p4: () => void; + override foo (v: string) {} + + fooo (v: string) {} + +} + +class DD extends B { + override foo: () => void + fooo: () => void; +} \ No newline at end of file From a65df911f9f1b3dc995c88df53bd3d78ed0e42d8 Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 21 Jul 2020 15:19:32 +0800 Subject: [PATCH 11/61] Fix decalre modifier --- src/compiler/checker.ts | 9 ++++++++- src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/types.ts | 2 +- src/compiler/utilities.ts | 4 ++++ tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- tests/cases/conformance/override/override5.ts | 12 ++++++++++++ 7 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tests/cases/conformance/override/override5.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c24c162442058..4d0572a2276b0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34420,7 +34420,14 @@ namespace ts { for (const member of node.members) { const hasOverride = hasOverrideModifier(member); - if (baseWithThis) { + const hasAmbient = hasAmbientModifier(member); + + if (hasAmbient) { + if (hasOverride) { + error(member, Diagnostics.Override_modifier_cannot_be_used_with_declare_modifier); + } + } + else if (baseWithThis) { const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); if (declaredProp) { const baseClassName = typeToString(baseWithThis); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 18c67a4cff5b9..fc19fa9abd7c2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3373,6 +3373,10 @@ "category": "Error", "code": 4113 }, + "Override modifier cannot be used with declare modifier.": { + "category": "Error", + "code": 4114 + }, "The current host does not support the '{0}' option.": { "category": "Error", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 4932352bbc558..d8ef77ed4d01c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -800,7 +800,7 @@ namespace ts { ParameterPropertyModifier = AccessibilityModifier | Readonly, NonPublicAccessibilityModifier = Private | Protected, - TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const, + TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const | Override, ExportDefault = Export | Default, All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Async | Default | Const | Deprecated | Override } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7046ac95d538c..6616f5ae252c9 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4533,6 +4533,10 @@ namespace ts { return hasSyntacticModifier(node, ModifierFlags.Override); } + export function hasAmbientModifier(node: Node): boolean { + return hasSyntacticModifier(node, ModifierFlags.Ambient); + } + export function hasEffectiveReadonlyModifier(node: Node): boolean { return hasEffectiveModifier(node, ModifierFlags.Readonly); } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index d532649ceec64..71ad8ac0fcae3 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -534,7 +534,7 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 92, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 2270, + TypeScriptModifier = 18654, ExportDefault = 513, All = 27647 } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1ecdd052365b3..f73bdf69cdf8d 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -534,7 +534,7 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 92, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 2270, + TypeScriptModifier = 18654, ExportDefault = 513, All = 27647 } diff --git a/tests/cases/conformance/override/override5.ts b/tests/cases/conformance/override/override5.ts new file mode 100644 index 0000000000000..c611fb7c1b002 --- /dev/null +++ b/tests/cases/conformance/override/override5.ts @@ -0,0 +1,12 @@ +// @declaration: true +// @pedanticOverride: true +class B { + p1: number = 1; + p2: number = 2; +} + +class D extends B{ + declare p1: number + + override declare p2: number +} From 43d9f701ec6596d804fb84cc313deba1c1c71d38 Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 21 Jul 2020 15:24:51 +0800 Subject: [PATCH 12/61] update baseline --- src/compiler/checker.ts | 5 +- .../baselines/reference/override3.errors.txt | 11 ++-- tests/baselines/reference/override3.js | 18 +++++++ tests/baselines/reference/override3.symbols | 11 ++++ tests/baselines/reference/override3.types | 11 ++++ .../baselines/reference/override5.errors.txt | 17 ++++++ tests/baselines/reference/override5.js | 52 +++++++++++++++++++ tests/baselines/reference/override5.symbols | 22 ++++++++ tests/baselines/reference/override5.types | 24 +++++++++ tests/cases/conformance/override/override3.ts | 5 ++ 10 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 tests/baselines/reference/override5.errors.txt create mode 100644 tests/baselines/reference/override5.js create mode 100644 tests/baselines/reference/override5.symbols create mode 100644 tests/baselines/reference/override5.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4d0572a2276b0..8deffcc029596 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34319,7 +34319,8 @@ namespace ts { checkClassForDuplicateDeclarations(node); // Only check for reserved static identifiers on non-ambient context. - if (!(node.flags & NodeFlags.Ambient)) { + const nodeInAmbientContext = !!(node.flags & NodeFlags.Ambient) + if (!nodeInAmbientContext) { checkClassForStaticPropertyNameConflicts(node); } @@ -34375,7 +34376,7 @@ namespace ts { } } - if (compilerOptions.pedanticOverride) { + if (compilerOptions.pedanticOverride && !nodeInAmbientContext) { issueMemberWithOverride(node, type, typeWithThis); } diff --git a/tests/baselines/reference/override3.errors.txt b/tests/baselines/reference/override3.errors.txt index 32e1fbcfe858b..75428c0a45f6a 100644 --- a/tests/baselines/reference/override3.errors.txt +++ b/tests/baselines/reference/override3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override3.ts(7,5): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override3.ts(22,5): error TS4113: Method must have override modifier because it's override the base class 'D'. ==== tests/cases/conformance/override/override3.ts (1 errors) ==== @@ -9,8 +9,6 @@ tests/cases/conformance/override/override3.ts(7,5): error TS4113: Method must ha declare class D extends B { foo (): void; - ~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. override bar (): void; } @@ -23,4 +21,11 @@ tests/cases/conformance/override/override3.ts(7,5): error TS4113: Method must ha override foo(): void {} override bar(): void {} } + + class EB extends D { + foo(): void {} + ~~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'D'. + override bar(): void {} + } \ No newline at end of file diff --git a/tests/baselines/reference/override3.js b/tests/baselines/reference/override3.js index 751e347dfb700..e392164f5b935 100644 --- a/tests/baselines/reference/override3.js +++ b/tests/baselines/reference/override3.js @@ -18,6 +18,11 @@ class DD extends D { override foo(): void {} override bar(): void {} } + +class EB extends D { + foo(): void {} + override bar(): void {} +} //// [override3.js] @@ -52,6 +57,15 @@ var DD = /** @class */ (function (_super) { DD.prototype.bar = function () { }; return DD; }(D)); +var EB = /** @class */ (function (_super) { + __extends(EB, _super); + function EB() { + return _super !== null && _super.apply(this, arguments) || this; + } + EB.prototype.foo = function () { }; + EB.prototype.bar = function () { }; + return EB; +}(D)); //// [override3.d.ts] @@ -71,3 +85,7 @@ declare class DD extends D { override foo(): void; override bar(): void; } +declare class EB extends D { + foo(): void; + override bar(): void; +} diff --git a/tests/baselines/reference/override3.symbols b/tests/baselines/reference/override3.symbols index ed75ec1bbb568..cc529eef3fffb 100644 --- a/tests/baselines/reference/override3.symbols +++ b/tests/baselines/reference/override3.symbols @@ -42,3 +42,14 @@ class DD extends D { >bar : Symbol(DD.bar, Decl(override3.ts, 16, 27)) } +class EB extends D { +>EB : Symbol(EB, Decl(override3.ts, 18, 1)) +>D : Symbol(D, Decl(override3.ts, 3, 1)) + + foo(): void {} +>foo : Symbol(EB.foo, Decl(override3.ts, 20, 20)) + + override bar(): void {} +>bar : Symbol(EB.bar, Decl(override3.ts, 21, 18)) +} + diff --git a/tests/baselines/reference/override3.types b/tests/baselines/reference/override3.types index c6a7791197c8e..6e94141d6ef5f 100644 --- a/tests/baselines/reference/override3.types +++ b/tests/baselines/reference/override3.types @@ -42,3 +42,14 @@ class DD extends D { >bar : () => void } +class EB extends D { +>EB : EB +>D : D + + foo(): void {} +>foo : () => void + + override bar(): void {} +>bar : () => void +} + diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt new file mode 100644 index 0000000000000..f20ca103b23ea --- /dev/null +++ b/tests/baselines/reference/override5.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/override/override5.ts(9,22): error TS4114: Override modifier cannot be used with declare modifier. + + +==== tests/cases/conformance/override/override5.ts (1 errors) ==== + class B { + p1: number = 1; + p2: number = 2; + } + + class D extends B{ + declare p1: number + + override declare p2: number + ~~ +!!! error TS4114: Override modifier cannot be used with declare modifier. + } + \ No newline at end of file diff --git a/tests/baselines/reference/override5.js b/tests/baselines/reference/override5.js new file mode 100644 index 0000000000000..8cfca389402e3 --- /dev/null +++ b/tests/baselines/reference/override5.js @@ -0,0 +1,52 @@ +//// [override5.ts] +class B { + p1: number = 1; + p2: number = 2; +} + +class D extends B{ + declare p1: number + + override declare p2: number +} + + +//// [override5.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var B = /** @class */ (function () { + function B() { + this.p1 = 1; + this.p2 = 2; + } + return B; +}()); +var D = /** @class */ (function (_super) { + __extends(D, _super); + function D() { + return _super !== null && _super.apply(this, arguments) || this; + } + return D; +}(B)); + + +//// [override5.d.ts] +declare class B { + p1: number; + p2: number; +} +declare class D extends B { + p1: number; + override p2: number; +} diff --git a/tests/baselines/reference/override5.symbols b/tests/baselines/reference/override5.symbols new file mode 100644 index 0000000000000..6c153f2cf26ec --- /dev/null +++ b/tests/baselines/reference/override5.symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/override/override5.ts === +class B { +>B : Symbol(B, Decl(override5.ts, 0, 0)) + + p1: number = 1; +>p1 : Symbol(B.p1, Decl(override5.ts, 0, 9)) + + p2: number = 2; +>p2 : Symbol(B.p2, Decl(override5.ts, 1, 19)) +} + +class D extends B{ +>D : Symbol(D, Decl(override5.ts, 3, 1)) +>B : Symbol(B, Decl(override5.ts, 0, 0)) + + declare p1: number +>p1 : Symbol(D.p1, Decl(override5.ts, 5, 18)) + + override declare p2: number +>p2 : Symbol(D.p2, Decl(override5.ts, 6, 22)) +} + diff --git a/tests/baselines/reference/override5.types b/tests/baselines/reference/override5.types new file mode 100644 index 0000000000000..c950fe44d8615 --- /dev/null +++ b/tests/baselines/reference/override5.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/override/override5.ts === +class B { +>B : B + + p1: number = 1; +>p1 : number +>1 : 1 + + p2: number = 2; +>p2 : number +>2 : 2 +} + +class D extends B{ +>D : D +>B : B + + declare p1: number +>p1 : number + + override declare p2: number +>p2 : number +} + diff --git a/tests/cases/conformance/override/override3.ts b/tests/cases/conformance/override/override3.ts index 82a4b81605da9..7c68d65919e93 100644 --- a/tests/cases/conformance/override/override3.ts +++ b/tests/cases/conformance/override/override3.ts @@ -19,3 +19,8 @@ class DD extends D { override foo(): void {} override bar(): void {} } + +class EB extends D { + foo(): void {} + override bar(): void {} +} From e73c94197295156d0e2268411c03a625bfa73078 Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 21 Jul 2020 15:32:52 +0800 Subject: [PATCH 13/61] Add more cases --- .../baselines/reference/override6.errors.txt | 20 ++++++ tests/baselines/reference/override6.js | 64 +++++++++++++++++++ tests/baselines/reference/override6.symbols | 31 +++++++++ tests/baselines/reference/override6.types | 35 ++++++++++ tests/cases/conformance/override/override6.ts | 15 +++++ 5 files changed, 165 insertions(+) create mode 100644 tests/baselines/reference/override6.errors.txt create mode 100644 tests/baselines/reference/override6.js create mode 100644 tests/baselines/reference/override6.symbols create mode 100644 tests/baselines/reference/override6.types create mode 100644 tests/cases/conformance/override/override6.ts diff --git a/tests/baselines/reference/override6.errors.txt b/tests/baselines/reference/override6.errors.txt new file mode 100644 index 0000000000000..ab8e2ced50ab0 --- /dev/null +++ b/tests/baselines/reference/override6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/override/override6.ts(9,12): error TS4113: Method must have override modifier because it's override the base class 'B'. + + +==== tests/cases/conformance/override/override6.ts (1 errors) ==== + class B { + public baz: number = 1; + constructor(public foo: string, public bar: number) { + + } + } + + class D extends B { + public bar: number = 1 + ~~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. + constructor(public foo: string, public baz: number) { + super(foo, 42) + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/override6.js b/tests/baselines/reference/override6.js new file mode 100644 index 0000000000000..05471cdbc22f6 --- /dev/null +++ b/tests/baselines/reference/override6.js @@ -0,0 +1,64 @@ +//// [override6.ts] +class B { + public baz: number = 1; + constructor(public foo: string, public bar: number) { + + } +} + +class D extends B { + public bar: number = 1 + constructor(public foo: string, public baz: number) { + super(foo, 42) + } +} + + +//// [override6.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var B = /** @class */ (function () { + function B(foo, bar) { + this.foo = foo; + this.bar = bar; + this.baz = 1; + } + return B; +}()); +var D = /** @class */ (function (_super) { + __extends(D, _super); + function D(foo, baz) { + var _this = _super.call(this, foo, 42) || this; + _this.foo = foo; + _this.baz = baz; + _this.bar = 1; + return _this; + } + return D; +}(B)); + + +//// [override6.d.ts] +declare class B { + foo: string; + bar: number; + baz: number; + constructor(foo: string, bar: number); +} +declare class D extends B { + foo: string; + baz: number; + bar: number; + constructor(foo: string, baz: number); +} diff --git a/tests/baselines/reference/override6.symbols b/tests/baselines/reference/override6.symbols new file mode 100644 index 0000000000000..b341f2276cde4 --- /dev/null +++ b/tests/baselines/reference/override6.symbols @@ -0,0 +1,31 @@ +=== tests/cases/conformance/override/override6.ts === +class B { +>B : Symbol(B, Decl(override6.ts, 0, 0)) + + public baz: number = 1; +>baz : Symbol(B.baz, Decl(override6.ts, 0, 9)) + + constructor(public foo: string, public bar: number) { +>foo : Symbol(B.foo, Decl(override6.ts, 2, 16)) +>bar : Symbol(B.bar, Decl(override6.ts, 2, 35)) + + } +} + +class D extends B { +>D : Symbol(D, Decl(override6.ts, 5, 1)) +>B : Symbol(B, Decl(override6.ts, 0, 0)) + + public bar: number = 1 +>bar : Symbol(D.bar, Decl(override6.ts, 7, 19)) + + constructor(public foo: string, public baz: number) { +>foo : Symbol(D.foo, Decl(override6.ts, 9, 16)) +>baz : Symbol(D.baz, Decl(override6.ts, 9, 35)) + + super(foo, 42) +>super : Symbol(B, Decl(override6.ts, 0, 0)) +>foo : Symbol(foo, Decl(override6.ts, 9, 16)) + } +} + diff --git a/tests/baselines/reference/override6.types b/tests/baselines/reference/override6.types new file mode 100644 index 0000000000000..a57f57847bf2c --- /dev/null +++ b/tests/baselines/reference/override6.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/override/override6.ts === +class B { +>B : B + + public baz: number = 1; +>baz : number +>1 : 1 + + constructor(public foo: string, public bar: number) { +>foo : string +>bar : number + + } +} + +class D extends B { +>D : D +>B : B + + public bar: number = 1 +>bar : number +>1 : 1 + + constructor(public foo: string, public baz: number) { +>foo : string +>baz : number + + super(foo, 42) +>super(foo, 42) : void +>super : typeof B +>foo : string +>42 : 42 + } +} + diff --git a/tests/cases/conformance/override/override6.ts b/tests/cases/conformance/override/override6.ts new file mode 100644 index 0000000000000..ff9c6ae2fcb8f --- /dev/null +++ b/tests/cases/conformance/override/override6.ts @@ -0,0 +1,15 @@ +// @declaration: true +// @pedanticOverride: true +class B { + public baz: number = 1; + constructor(public foo: string, public bar: number) { + + } +} + +class D extends B { + public bar: number = 1 + constructor(public foo: string, public baz: number) { + super(foo, 42) + } +} From c0edf6f473b8d92539435fa80a03552a7975cfdf Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 21 Jul 2020 16:00:30 +0800 Subject: [PATCH 14/61] make lint happy --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8deffcc029596..cff5bfc4479b0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34319,7 +34319,7 @@ namespace ts { checkClassForDuplicateDeclarations(node); // Only check for reserved static identifiers on non-ambient context. - const nodeInAmbientContext = !!(node.flags & NodeFlags.Ambient) + const nodeInAmbientContext = !!(node.flags & NodeFlags.Ambient); if (!nodeInAmbientContext) { checkClassForStaticPropertyNameConflicts(node); } From dca93acc7df8b26e3a2dde84c6a25371701ef5e3 Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 21 Jul 2020 17:18:22 +0800 Subject: [PATCH 15/61] make lint happy --- src/compiler/checker.ts | 40 ++++++++--- src/compiler/diagnosticMessages.json | 2 +- .../baselines/reference/override5.errors.txt | 37 ++++++++-- tests/baselines/reference/override5.js | 24 ++++++- tests/baselines/reference/override5.symbols | 32 ++++++++- tests/baselines/reference/override5.types | 27 ++++++++ .../baselines/reference/override7.errors.txt | 43 ++++++++++++ tests/baselines/reference/override7.js | 68 +++++++++++++++++++ tests/baselines/reference/override7.symbols | 39 +++++++++++ tests/baselines/reference/override7.types | 42 ++++++++++++ tests/cases/conformance/override/override5.ts | 14 ++++ tests/cases/conformance/override/override7.ts | 23 +++++++ 12 files changed, 373 insertions(+), 18 deletions(-) create mode 100644 tests/baselines/reference/override7.errors.txt create mode 100644 tests/baselines/reference/override7.js create mode 100644 tests/baselines/reference/override7.symbols create mode 100644 tests/baselines/reference/override7.types create mode 100644 tests/cases/conformance/override/override7.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cff5bfc4479b0..77e2b0704d3f4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34421,14 +34421,7 @@ namespace ts { for (const member of node.members) { const hasOverride = hasOverrideModifier(member); - const hasAmbient = hasAmbientModifier(member); - - if (hasAmbient) { - if (hasOverride) { - error(member, Diagnostics.Override_modifier_cannot_be_used_with_declare_modifier); - } - } - else if (baseWithThis) { + if (baseWithThis) { const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); if (declaredProp) { const baseClassName = typeToString(baseWithThis); @@ -37749,7 +37742,7 @@ namespace ts { return quickResult; } - let lastStatic: Node | undefined, lastDeclare: Node | undefined, lastAsync: Node | undefined, lastReadonly: Node | undefined; + let lastStatic: Node | undefined, lastDeclare: Node | undefined, lastAsync: Node | undefined, lastReadonly: Node | undefined, lastOverride: Node | undefined; let flags = ModifierFlags.None; for (const modifier of node.modifiers!) { if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { @@ -37766,6 +37759,23 @@ namespace ts { return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(SyntaxKind.ConstKeyword)); } break; + case SyntaxKind.OverrideKeyword: + if (!compilerOptions.pedanticOverride) { + return grammarErrorOnNode(modifier, Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option); + } + if (flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override"); + } + else if(flags & ModifierFlags.Ambient) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare"); + } + else if(flags & ModifierFlags.Static) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "override"); + } + flags |= ModifierFlags.Override; + lastOverride = modifier; + break; + case SyntaxKind.PublicKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.PrivateKeyword: @@ -37774,6 +37784,9 @@ namespace ts { if (flags & ModifierFlags.AccessibilityModifier) { return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen); } + else if (compilerOptions.pedanticOverride && flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "override"); + } else if (flags & ModifierFlags.Static) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } @@ -37807,6 +37820,9 @@ namespace ts { else if (flags & ModifierFlags.Readonly) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } + else if (compilerOptions.pedanticOverride && flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "override"); + } else if (flags & ModifierFlags.Async) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } @@ -37874,6 +37890,9 @@ namespace ts { else if (flags & ModifierFlags.Async) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } + else if (compilerOptions.pedanticOverride && flags & ModifierFlags.Override) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override"); + } else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } @@ -37941,6 +37960,9 @@ namespace ts { if (flags & ModifierFlags.Abstract) { return grammarErrorOnNode(lastStatic!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); // TODO: GH#18217 } + if (compilerOptions.pedanticOverride && flags & ModifierFlags.Override) { + return grammarErrorOnNode(lastOverride!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 + } else if (flags & ModifierFlags.Async) { return grammarErrorOnNode(lastAsync!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fc19fa9abd7c2..904376189ee0a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3373,7 +3373,7 @@ "category": "Error", "code": 4113 }, - "Override modifier cannot be used with declare modifier.": { + "'Override' modifier must be used with 'pedanticOverride ' compiler option": { "category": "Error", "code": 4114 }, diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt index f20ca103b23ea..b1beb5a9438a7 100644 --- a/tests/baselines/reference/override5.errors.txt +++ b/tests/baselines/reference/override5.errors.txt @@ -1,17 +1,46 @@ -tests/cases/conformance/override/override5.ts(9,22): error TS4114: Override modifier cannot be used with declare modifier. +tests/cases/conformance/override/override5.ts(10,13): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override5.ts(12,14): error TS1040: 'override' modifier cannot be used in an ambient context. +tests/cases/conformance/override/override5.ts(14,14): error TS1243: 'static' modifier cannot be used with 'override' modifier. +tests/cases/conformance/override/override5.ts(16,14): error TS1030: 'override' modifier already seen. +tests/cases/conformance/override/override5.ts(19,14): error TS1029: 'public' modifier must precede 'override' modifier. +tests/cases/conformance/override/override5.ts(21,5): error TS1089: 'override' modifier cannot appear on a constructor declaration. -==== tests/cases/conformance/override/override5.ts (1 errors) ==== +==== tests/cases/conformance/override/override5.ts (6 errors) ==== class B { p1: number = 1; p2: number = 2; + oop: number; + pp: number; + op: number; } class D extends B{ declare p1: number + ~~ +!!! error TS4113: Method must have override modifier because it's override the base class 'B'. override declare p2: number - ~~ -!!! error TS4114: Override modifier cannot be used with declare modifier. + ~~~~~~~ +!!! error TS1040: 'override' modifier cannot be used in an ambient context. + + override static sp: number; + ~~~~~~ +!!! error TS1243: 'static' modifier cannot be used with 'override' modifier. + + override override oop: number; + ~~~~~~~~ +!!! error TS1030: 'override' modifier already seen. + + public override pp: number; + override public op: number; + ~~~~~~ +!!! error TS1029: 'public' modifier must precede 'override' modifier. + + override constructor () { + ~~~~~~~~ +!!! error TS1089: 'override' modifier cannot appear on a constructor declaration. + super(); + } } \ No newline at end of file diff --git a/tests/baselines/reference/override5.js b/tests/baselines/reference/override5.js index 8cfca389402e3..2da9b88a3c773 100644 --- a/tests/baselines/reference/override5.js +++ b/tests/baselines/reference/override5.js @@ -2,12 +2,26 @@ class B { p1: number = 1; p2: number = 2; + oop: number; + pp: number; + op: number; } class D extends B{ declare p1: number override declare p2: number + + override static sp: number; + + override override oop: number; + + public override pp: number; + override public op: number; + + override constructor () { + super(); + } } @@ -35,7 +49,7 @@ var B = /** @class */ (function () { var D = /** @class */ (function (_super) { __extends(D, _super); function D() { - return _super !== null && _super.apply(this, arguments) || this; + return _super.call(this) || this; } return D; }(B)); @@ -45,8 +59,16 @@ var D = /** @class */ (function (_super) { declare class B { p1: number; p2: number; + oop: number; + pp: number; + op: number; } declare class D extends B { p1: number; override p2: number; + override static sp: number; + override override oop: number; + override pp: number; + override op: number; + override constructor(); } diff --git a/tests/baselines/reference/override5.symbols b/tests/baselines/reference/override5.symbols index 6c153f2cf26ec..f2aabff9e30cf 100644 --- a/tests/baselines/reference/override5.symbols +++ b/tests/baselines/reference/override5.symbols @@ -7,16 +7,42 @@ class B { p2: number = 2; >p2 : Symbol(B.p2, Decl(override5.ts, 1, 19)) + + oop: number; +>oop : Symbol(B.oop, Decl(override5.ts, 2, 19)) + + pp: number; +>pp : Symbol(B.pp, Decl(override5.ts, 3, 16)) + + op: number; +>op : Symbol(B.op, Decl(override5.ts, 4, 15)) } class D extends B{ ->D : Symbol(D, Decl(override5.ts, 3, 1)) +>D : Symbol(D, Decl(override5.ts, 6, 1)) >B : Symbol(B, Decl(override5.ts, 0, 0)) declare p1: number ->p1 : Symbol(D.p1, Decl(override5.ts, 5, 18)) +>p1 : Symbol(D.p1, Decl(override5.ts, 8, 18)) override declare p2: number ->p2 : Symbol(D.p2, Decl(override5.ts, 6, 22)) +>p2 : Symbol(D.p2, Decl(override5.ts, 9, 22)) + + override static sp: number; +>sp : Symbol(D.sp, Decl(override5.ts, 11, 31)) + + override override oop: number; +>oop : Symbol(D.oop, Decl(override5.ts, 13, 31)) + + public override pp: number; +>pp : Symbol(D.pp, Decl(override5.ts, 15, 34)) + + override public op: number; +>op : Symbol(D.op, Decl(override5.ts, 17, 31)) + + override constructor () { + super(); +>super : Symbol(B, Decl(override5.ts, 0, 0)) + } } diff --git a/tests/baselines/reference/override5.types b/tests/baselines/reference/override5.types index c950fe44d8615..56235de97d3a7 100644 --- a/tests/baselines/reference/override5.types +++ b/tests/baselines/reference/override5.types @@ -9,6 +9,15 @@ class B { p2: number = 2; >p2 : number >2 : 2 + + oop: number; +>oop : number + + pp: number; +>pp : number + + op: number; +>op : number } class D extends B{ @@ -20,5 +29,23 @@ class D extends B{ override declare p2: number >p2 : number + + override static sp: number; +>sp : number + + override override oop: number; +>oop : number + + public override pp: number; +>pp : number + + override public op: number; +>op : number + + override constructor () { + super(); +>super() : void +>super : typeof B + } } diff --git a/tests/baselines/reference/override7.errors.txt b/tests/baselines/reference/override7.errors.txt new file mode 100644 index 0000000000000..e1d19cd62d0b2 --- /dev/null +++ b/tests/baselines/reference/override7.errors.txt @@ -0,0 +1,43 @@ +tests/cases/conformance/override/override7.ts(9,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +tests/cases/conformance/override/override7.ts(11,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +tests/cases/conformance/override/override7.ts(13,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +tests/cases/conformance/override/override7.ts(15,12): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +tests/cases/conformance/override/override7.ts(16,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +tests/cases/conformance/override/override7.ts(18,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option + + +==== tests/cases/conformance/override/override7.ts (6 errors) ==== + class B { + p1: number = 1; + p2: number = 2; + } + + class D extends B{ + declare p1: number + + override declare p2: number + ~~~~~~~~ +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option + + override static sp: number; + ~~~~~~~~ +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option + + override override oop: number; + ~~~~~~~~ +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option + + public override pp: number; + ~~~~~~~~ +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option + override public op: number; + ~~~~~~~~ +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option + + override constructor () { + ~~~~~~~~ +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option + super(); + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/override7.js b/tests/baselines/reference/override7.js new file mode 100644 index 0000000000000..71564dafc0f11 --- /dev/null +++ b/tests/baselines/reference/override7.js @@ -0,0 +1,68 @@ +//// [override7.ts] +class B { + p1: number = 1; + p2: number = 2; +} + +class D extends B{ + declare p1: number + + override declare p2: number + + override static sp: number; + + override override oop: number; + + public override pp: number; + override public op: number; + + override constructor () { + super(); + } +} + + +//// [override7.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var B = /** @class */ (function () { + function B() { + this.p1 = 1; + this.p2 = 2; + } + return B; +}()); +var D = /** @class */ (function (_super) { + __extends(D, _super); + function D() { + return _super.call(this) || this; + } + return D; +}(B)); + + +//// [override7.d.ts] +declare class B { + p1: number; + p2: number; +} +declare class D extends B { + p1: number; + override p2: number; + override static sp: number; + override override oop: number; + override pp: number; + override op: number; + override constructor(); +} diff --git a/tests/baselines/reference/override7.symbols b/tests/baselines/reference/override7.symbols new file mode 100644 index 0000000000000..98a4e85ff5fc9 --- /dev/null +++ b/tests/baselines/reference/override7.symbols @@ -0,0 +1,39 @@ +=== tests/cases/conformance/override/override7.ts === +class B { +>B : Symbol(B, Decl(override7.ts, 0, 0)) + + p1: number = 1; +>p1 : Symbol(B.p1, Decl(override7.ts, 0, 9)) + + p2: number = 2; +>p2 : Symbol(B.p2, Decl(override7.ts, 1, 19)) +} + +class D extends B{ +>D : Symbol(D, Decl(override7.ts, 3, 1)) +>B : Symbol(B, Decl(override7.ts, 0, 0)) + + declare p1: number +>p1 : Symbol(D.p1, Decl(override7.ts, 5, 18)) + + override declare p2: number +>p2 : Symbol(D.p2, Decl(override7.ts, 6, 22)) + + override static sp: number; +>sp : Symbol(D.sp, Decl(override7.ts, 8, 31)) + + override override oop: number; +>oop : Symbol(D.oop, Decl(override7.ts, 10, 31)) + + public override pp: number; +>pp : Symbol(D.pp, Decl(override7.ts, 12, 34)) + + override public op: number; +>op : Symbol(D.op, Decl(override7.ts, 14, 31)) + + override constructor () { + super(); +>super : Symbol(B, Decl(override7.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/override7.types b/tests/baselines/reference/override7.types new file mode 100644 index 0000000000000..e7524ccc47d19 --- /dev/null +++ b/tests/baselines/reference/override7.types @@ -0,0 +1,42 @@ +=== tests/cases/conformance/override/override7.ts === +class B { +>B : B + + p1: number = 1; +>p1 : number +>1 : 1 + + p2: number = 2; +>p2 : number +>2 : 2 +} + +class D extends B{ +>D : D +>B : B + + declare p1: number +>p1 : number + + override declare p2: number +>p2 : number + + override static sp: number; +>sp : number + + override override oop: number; +>oop : number + + public override pp: number; +>pp : number + + override public op: number; +>op : number + + override constructor () { + super(); +>super() : void +>super : typeof B + } +} + diff --git a/tests/cases/conformance/override/override5.ts b/tests/cases/conformance/override/override5.ts index c611fb7c1b002..22418395f3543 100644 --- a/tests/cases/conformance/override/override5.ts +++ b/tests/cases/conformance/override/override5.ts @@ -3,10 +3,24 @@ class B { p1: number = 1; p2: number = 2; + oop: number; + pp: number; + op: number; } class D extends B{ declare p1: number override declare p2: number + + override static sp: number; + + override override oop: number; + + public override pp: number; + override public op: number; + + override constructor () { + super(); + } } diff --git a/tests/cases/conformance/override/override7.ts b/tests/cases/conformance/override/override7.ts new file mode 100644 index 0000000000000..d995847c1dcc3 --- /dev/null +++ b/tests/cases/conformance/override/override7.ts @@ -0,0 +1,23 @@ +// @declaration: true +// @pedanticOverride: false +class B { + p1: number = 1; + p2: number = 2; +} + +class D extends B{ + declare p1: number + + override declare p2: number + + override static sp: number; + + override override oop: number; + + public override pp: number; + override public op: number; + + override constructor () { + super(); + } +} From 2fd560ae922a171eb377e7905d41ea925fc144bd Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 21 Jul 2020 17:26:33 +0800 Subject: [PATCH 16/61] Update description --- src/compiler/checker.ts | 6 ++-- src/compiler/diagnosticMessages.json | 6 ++-- .../baselines/reference/override1.errors.txt | 32 +++++++++---------- .../baselines/reference/override2.errors.txt | 8 ++--- .../baselines/reference/override3.errors.txt | 4 +-- .../baselines/reference/override4.errors.txt | 16 +++++----- .../baselines/reference/override5.errors.txt | 4 +-- .../baselines/reference/override6.errors.txt | 4 +-- 8 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 77e2b0704d3f4..fb85e6ce5f3d8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34428,16 +34428,16 @@ namespace ts { const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); if (prop && !baseProp && hasOverride) { - error(member, Diagnostics.Method_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0, baseClassName); + error(member, Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0, baseClassName); } else if (prop && baseProp && !hasOverride) { - error(member, Diagnostics.Method_must_have_override_modifier_because_it_s_override_the_base_class_0, baseClassName); + error(member, Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0, baseClassName); } } } else if (hasOverride) { const className = typeToString(type); - error(member, Diagnostics.Method_cannot_have_override_modifier_because_class_0_does_not_extended_another_class, className); + error(member, Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class, className); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 904376189ee0a..3b5643c1daf02 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3361,15 +3361,15 @@ "category": "Error", "code": 4110 }, - "Method cannot have override modifier because class '{0}' does not extended another class.": { + "Class member cannot have override modifier because class '{0}' does not extended another class.": { "category": "Error", "code": 4111 }, - "Method cannot have override modifier because it's not existed in the base class '{0}'.": { + "Class member cannot have override modifier because it's not existed in the base class '{0}'.": { "category": "Error", "code": 4112 }, - "Method must have override modifier because it's override the base class '{0}'.": { + "Class member must have override modifier because it's override the base class '{0}'.": { "category": "Error", "code": 4113 }, diff --git a/tests/baselines/reference/override1.errors.txt b/tests/baselines/reference/override1.errors.txt index 002538a443664..7e35d3aec567e 100644 --- a/tests/baselines/reference/override1.errors.txt +++ b/tests/baselines/reference/override1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/override/override1.ts(9,5): error TS4113: Method must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override1.ts(11,14): error TS4112: Method cannot have override modifier because it's not existed in the base class 'B'. -tests/cases/conformance/override/override1.ts(15,14): error TS4111: Method cannot have override modifier because class 'C' does not extended another class. -tests/cases/conformance/override/override1.ts(22,9): error TS4113: Method must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override1.ts(24,18): error TS4112: Method cannot have override modifier because it's not existed in the base class 'B'. -tests/cases/conformance/override/override1.ts(33,5): error TS4113: Method must have override modifier because it's override the base class '(Anonymous class)'. -tests/cases/conformance/override/override1.ts(37,14): error TS4112: Method cannot have override modifier because it's not existed in the base class '(Anonymous class)'. -tests/cases/conformance/override/override1.ts(42,18): error TS4111: Method cannot have override modifier because class '(Anonymous class)' does not extended another class. +tests/cases/conformance/override/override1.ts(9,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override1.ts(11,14): error TS4112: Class member cannot have override modifier because it's not existed in the base class 'B'. +tests/cases/conformance/override/override1.ts(15,14): error TS4111: Class member cannot have override modifier because class 'C' does not extended another class. +tests/cases/conformance/override/override1.ts(22,9): error TS4113: Class member must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override1.ts(24,18): error TS4112: Class member cannot have override modifier because it's not existed in the base class 'B'. +tests/cases/conformance/override/override1.ts(33,5): error TS4113: Class member must have override modifier because it's override the base class '(Anonymous class)'. +tests/cases/conformance/override/override1.ts(37,14): error TS4112: Class member cannot have override modifier because it's not existed in the base class '(Anonymous class)'. +tests/cases/conformance/override/override1.ts(42,18): error TS4111: Class member cannot have override modifier because class '(Anonymous class)' does not extended another class. ==== tests/cases/conformance/override/override1.ts (8 errors) ==== @@ -19,17 +19,17 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: Method canno fooo (v: string) {} ~~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. override bar(v: string) {} ~~~ -!!! error TS4112: Method cannot have override modifier because it's not existed in the base class 'B'. +!!! error TS4112: Class member cannot have override modifier because it's not existed in the base class 'B'. } class C { override foo(v: string) {} ~~~ -!!! error TS4111: Method cannot have override modifier because class 'C' does not extended another class. +!!! error TS4111: Class member cannot have override modifier because class 'C' does not extended another class. } function f () { @@ -38,11 +38,11 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: Method canno fooo (v: string) {} ~~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. override bar(v: string) {} ~~~ -!!! error TS4112: Method cannot have override modifier because it's not existed in the base class 'B'. +!!! error TS4112: Class member cannot have override modifier because it's not existed in the base class 'B'. } } @@ -53,19 +53,19 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: Method canno override foo () { } bar () { } ~~~ -!!! error TS4113: Method must have override modifier because it's override the base class '(Anonymous class)'. +!!! error TS4113: Class member must have override modifier because it's override the base class '(Anonymous class)'. baz() {} override bazz () {} ~~~~ -!!! error TS4112: Method cannot have override modifier because it's not existed in the base class '(Anonymous class)'. +!!! error TS4112: Class member cannot have override modifier because it's not existed in the base class '(Anonymous class)'. } function ff () { return class { override foo () {} ~~~ -!!! error TS4111: Method cannot have override modifier because class '(Anonymous class)' does not extended another class. +!!! error TS4111: Class member cannot have override modifier because class '(Anonymous class)' does not extended another class. } } \ No newline at end of file diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt index 7687558c24a4f..aa2fe34aedaeb 100644 --- a/tests/baselines/reference/override2.errors.txt +++ b/tests/baselines/reference/override2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/override/override2.ts(12,14): error TS4113: Method must have override modifier because it's override the base class 'AB'. -tests/cases/conformance/override/override2.ts(17,14): error TS4113: Method must have override modifier because it's override the base class 'AB'. +tests/cases/conformance/override/override2.ts(12,14): error TS4113: Class member must have override modifier because it's override the base class 'AB'. +tests/cases/conformance/override/override2.ts(17,14): error TS4113: Class member must have override modifier because it's override the base class 'AB'. ==== tests/cases/conformance/override/override2.ts (2 errors) ==== @@ -16,14 +16,14 @@ tests/cases/conformance/override/override2.ts(17,14): error TS4113: Method must abstract class AD2 extends AB { abstract foo(v: ''): void // need override? ~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'AB'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'AB'. } abstract class AD3 extends AB { override foo(v: ''): void { } // need override? abstract bar(): void; ~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'AB'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'AB'. } class D4 extends AB { diff --git a/tests/baselines/reference/override3.errors.txt b/tests/baselines/reference/override3.errors.txt index 75428c0a45f6a..2f05f1a81d4eb 100644 --- a/tests/baselines/reference/override3.errors.txt +++ b/tests/baselines/reference/override3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override3.ts(22,5): error TS4113: Method must have override modifier because it's override the base class 'D'. +tests/cases/conformance/override/override3.ts(22,5): error TS4113: Class member must have override modifier because it's override the base class 'D'. ==== tests/cases/conformance/override/override3.ts (1 errors) ==== @@ -25,7 +25,7 @@ tests/cases/conformance/override/override3.ts(22,5): error TS4113: Method must h class EB extends D { foo(): void {} ~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'D'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'D'. override bar(): void {} } \ No newline at end of file diff --git a/tests/baselines/reference/override4.errors.txt b/tests/baselines/reference/override4.errors.txt index ee598c967210f..cc4257f41c93c 100644 --- a/tests/baselines/reference/override4.errors.txt +++ b/tests/baselines/reference/override4.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/override/override4.ts(11,5): error TS4113: Method must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override4.ts(13,5): error TS4113: Method must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override4.ts(17,5): error TS4113: Method must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override4.ts(23,5): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override4.ts(11,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override4.ts(13,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override4.ts(17,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override4.ts(23,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. ==== tests/cases/conformance/override/override4.ts (4 errors) ==== @@ -17,17 +17,17 @@ tests/cases/conformance/override/override4.ts(23,5): error TS4113: Method must h class D extends B { p1: number = 2; ~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. override p2: number = 3; p3: () => void; ~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. override p4: () => void; override foo (v: string) {} fooo (v: string) {} ~~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. } @@ -35,5 +35,5 @@ tests/cases/conformance/override/override4.ts(23,5): error TS4113: Method must h override foo: () => void fooo: () => void; ~~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. } \ No newline at end of file diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt index b1beb5a9438a7..215ef8b68787e 100644 --- a/tests/baselines/reference/override5.errors.txt +++ b/tests/baselines/reference/override5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override5.ts(10,13): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override5.ts(10,13): error TS4113: Class member must have override modifier because it's override the base class 'B'. tests/cases/conformance/override/override5.ts(12,14): error TS1040: 'override' modifier cannot be used in an ambient context. tests/cases/conformance/override/override5.ts(14,14): error TS1243: 'static' modifier cannot be used with 'override' modifier. tests/cases/conformance/override/override5.ts(16,14): error TS1030: 'override' modifier already seen. @@ -18,7 +18,7 @@ tests/cases/conformance/override/override5.ts(21,5): error TS1089: 'override' mo class D extends B{ declare p1: number ~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. override declare p2: number ~~~~~~~ diff --git a/tests/baselines/reference/override6.errors.txt b/tests/baselines/reference/override6.errors.txt index ab8e2ced50ab0..24ba41474beb8 100644 --- a/tests/baselines/reference/override6.errors.txt +++ b/tests/baselines/reference/override6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override6.ts(9,12): error TS4113: Method must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override6.ts(9,12): error TS4113: Class member must have override modifier because it's override the base class 'B'. ==== tests/cases/conformance/override/override6.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/override/override6.ts(9,12): error TS4113: Method must h class D extends B { public bar: number = 1 ~~~ -!!! error TS4113: Method must have override modifier because it's override the base class 'B'. +!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. constructor(public foo: string, public baz: number) { super(foo, 42) } From 94187c7a2619ee7ef6a39ff35c043c481a1aec25 Mon Sep 17 00:00:00 2001 From: kingwl Date: Wed, 19 Aug 2020 17:49:09 +0800 Subject: [PATCH 17/61] Add codefix --- src/compiler/diagnosticMessages.json | 22 +++- src/services/codeFixProvider.ts | 4 + src/services/codefixes/fixOverrideModifier.ts | 111 ++++++++++++++++++ src/services/tsconfig.json | 1 + .../codeFixOverrideEnableOverrideFlag.ts | 24 ++++ .../fourslash/codeFixOverrideModifier1.ts | 17 +++ .../fourslash/codeFixOverrideModifier2.ts | 19 +++ .../fourslash/codeFixOverrideModifier3.ts | 18 +++ .../fourslash/codeFixOverrideModifier4.ts | 17 +++ .../fourslash/codeFixOverrideModifier5.ts | 13 ++ .../fourslash/codeFixOverrideModifier6.ts | 20 ++++ .../fourslash/codeFixOverrideModifier7.ts | 19 +++ .../fourslash/codeFixOverrideModifier8.ts | 15 +++ .../codeFixOverrideModifier_fixAll1.ts | 75 ++++++++++++ .../codeFixOverrideModifier_fixAll2.ts | 75 ++++++++++++ 15 files changed, 449 insertions(+), 1 deletion(-) create mode 100644 src/services/codefixes/fixOverrideModifier.ts create mode 100644 tests/cases/fourslash/codeFixOverrideEnableOverrideFlag.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier1.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier2.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier3.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier4.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier5.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier6.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier7.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier8.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3b5643c1daf02..74e986b67618a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3373,7 +3373,7 @@ "category": "Error", "code": 4113 }, - "'Override' modifier must be used with 'pedanticOverride ' compiler option": { + "'Override' modifier must be used with 'pedanticOverride' compiler option": { "category": "Error", "code": 4114 }, @@ -5863,6 +5863,26 @@ "category": "Message", "code": 95142 }, + "Enable the '--pedanticOverride' flag in your configuration file": { + "category": "Message", + "code": 95143 + }, + "Add 'override' modifier": { + "category": "Message", + "code": 95144 + }, + "Remove 'override' modifier": { + "category": "Message", + "code": 95145 + }, + "Add all 'override' modifier": { + "category": "Message", + "code": 95146 + }, + "Remove all 'override' modifier": { + "category": "Message", + "code": 95147 + }, "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { "category": "Error", diff --git a/src/services/codeFixProvider.ts b/src/services/codeFixProvider.ts index aee5a199fad5b..5baf4734002fc 100644 --- a/src/services/codeFixProvider.ts +++ b/src/services/codeFixProvider.ts @@ -18,6 +18,10 @@ namespace ts.codefix { return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command); } + export function createCodeFixActionMaybeFixAll(fixName: string, changes: FileTextChanges[], description: DiagnosticAndArguments, fixId?: {}, fixAllDescription?: DiagnosticAndArguments, command?: CodeActionCommand) { + return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, fixAllDescription && diagnosticToString(fixAllDescription), command); + } + function createCodeFixActionWorker(fixName: string, description: string, changes: FileTextChanges[], fixId?: {}, fixAllDescription?: string, command?: CodeActionCommand): CodeFixAction { return { fixName, description, changes, fixId, fixAllDescription, commands: command ? [command] : undefined }; } diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts new file mode 100644 index 0000000000000..fc4b5be6bfa12 --- /dev/null +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -0,0 +1,111 @@ +/* @internal */ +namespace ts.codefix { + const fixName = "fixOverrideModifier"; + const fixAddOverrideId = "fixAddOverrideModifier"; + const fixRemoveOverrideId = "fixRemoveOverrideModifier"; + + const errorCodes = [ + Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code, + Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code, + Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code, + Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option.code + ]; + + const errorCodeFixIdMap = { + [Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code]: fixAddOverrideId, + [Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code]: fixRemoveOverrideId, + [Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code]: fixRemoveOverrideId, + }; + + registerCodeFix({ + errorCodes, + getCodeActions: context => { + const { errorCode, span } = context; + + const [changeFactory, descriptions, fixId, fixAllDescriptions] = dispatchChanges(context, errorCode, span.start); + const changes = textChanges.ChangeTracker.with(context, changeFactory); + + return [ + createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId, fixAllDescriptions) + ]; + }, + fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId], + getAllCodeActions: context => + codeFixAll(context, errorCodes, (changes, diag) => { + const { code, start } = diag; + if (errorCodeFixIdMap[code] !== context.fixId) { + return; + } + + const [changeFactory] = dispatchChanges(context, code, start); + changeFactory(changes); + }) + }); + + function dispatchChanges( + context: CodeFixContext | CodeFixAllContext, + errorCode: number, + pos: number): [ + changeFactory: (changeTracker: textChanges.ChangeTracker) => void, + descriptions: DiagnosticMessage, + fixId: string | undefined, + fixAllDescriptions: DiagnosticMessage | undefined + ] { + switch (errorCode) { + case Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code: + return [ + (changeTracker: textChanges.ChangeTracker) => doAddOverrideModifierChange(changeTracker, context.sourceFile, pos), + Diagnostics.Add_override_modifier, + fixAddOverrideId, + Diagnostics.Add_all_override_modifier, + ]; + case Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code: + case Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code: + return [ + (changeTracker: textChanges.ChangeTracker) => doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos), + Diagnostics.Remove_override_modifier, + fixRemoveOverrideId, + Diagnostics.Remove_all_override_modifier + ]; + case Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option.code: + return [ + (changeTracker: textChanges.ChangeTracker) => doAddFlagChange(changeTracker, context.program), + Diagnostics.Enable_the_pedanticOverride_flag_in_your_configuration_file, + undefined, + undefined + ]; + default: + Debug.fail("Unexpected error code: " + errorCode); + } + } + + function doAddFlagChange(changeTracker: textChanges.ChangeTracker, program: Program) { + const { configFile } = program.getCompilerOptions(); + if (configFile === undefined) { + return undefined; + } + + setJsonCompilerOptionValue(changeTracker, configFile, "pedanticOverride", factory.createTrue()); + } + + function doAddOverrideModifierChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) { + const classElement = findContainerClassElement(sourceFile, pos); + changeTracker.insertLastModifierBefore(sourceFile, SyntaxKind.OverrideKeyword, classElement); + } + + function doRemoveOverrideModifierChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) { + const classElement = findContainerClassElement(sourceFile, pos); + const overrideModifier = classElement.modifiers && find(classElement.modifiers, modifier => modifier.kind === SyntaxKind.OverrideKeyword); + Debug.assertIsDefined(overrideModifier); + + changeTracker.deleteModifier(sourceFile, overrideModifier); + } + + function findContainerClassElement(sourceFile: SourceFile, pos: number) { + const token = getTokenAtPosition(sourceFile, pos); + const classElement = findAncestor(token, isClassElement); + Debug.assertIsDefined(classElement); + return classElement; + } +} + diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index cc24ac7f9c405..ecaed723a0cc6 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -63,6 +63,7 @@ "codefixes/convertToTypeOnlyImport.ts", "codefixes/fixClassIncorrectlyImplementsInterface.ts", "codefixes/importFixes.ts", + "codefixes/fixOverrideModifier.ts", "codefixes/fixImplicitThis.ts", "codefixes/fixIncorrectNamedTupleSyntax.ts", "codefixes/fixSpelling.ts", diff --git a/tests/cases/fourslash/codeFixOverrideEnableOverrideFlag.ts b/tests/cases/fourslash/codeFixOverrideEnableOverrideFlag.ts new file mode 100644 index 0000000000000..48c5f178a5ef9 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideEnableOverrideFlag.ts @@ -0,0 +1,24 @@ +/// + +// @Filename: /dir/a.ts +//// class B { foo () {} } +//// class D extends B { override foo () {} } + +// @Filename: /dir/tsconfig.json +////{ +//// "compilerOptions": { +//// } +////} + +goTo.file("/dir/a.ts"); +verify.codeFix({ + description: "Enable the '--pedanticOverride' flag in your configuration file", + newFileContent: { + "/dir/tsconfig.json": +`{ + "compilerOptions": { + "pedanticOverride": true + } +}`, + }, +}); diff --git a/tests/cases/fourslash/codeFixOverrideModifier1.ts b/tests/cases/fourslash/codeFixOverrideModifier1.ts new file mode 100644 index 0000000000000..688597d03524c --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier1.ts @@ -0,0 +1,17 @@ +/// + +// @pedanticOverride: true +//// class B { +//// foo (v: string) {} +//// fooo (v: string) {} +//// } +//// class D extends B { +//// override foo (v: string) {} +//// [|fooo (v: string) {}|] +//// } + +verify.codeFix({ + description: "Add 'override' modifier", + newRangeContent: "override fooo (v: string) {}", + index: 0 +}) diff --git a/tests/cases/fourslash/codeFixOverrideModifier2.ts b/tests/cases/fourslash/codeFixOverrideModifier2.ts new file mode 100644 index 0000000000000..04f715491ecd2 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier2.ts @@ -0,0 +1,19 @@ +/// + +// @pedanticOverride: true +//// class B { +//// foo (v: string) {} +//// fooo (v: string) {} +//// } +//// function f () { +//// return class extends B { +//// override foo (v: string) {} +//// [|fooo (v: string) {}|] +//// } +//// } + +verify.codeFix({ + description: "Add 'override' modifier", + newRangeContent: "override fooo (v: string) {}", + index: 0 +}) diff --git a/tests/cases/fourslash/codeFixOverrideModifier3.ts b/tests/cases/fourslash/codeFixOverrideModifier3.ts new file mode 100644 index 0000000000000..fd67ed06caab3 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier3.ts @@ -0,0 +1,18 @@ +/// + +// @pedanticOverride: true + +//// class E extends (class { +//// foo () {} +//// bar () {} +//// }) { +//// override foo () {} +//// [|bar () {}|] +//// baz() {} +//// } + +verify.codeFix({ + description: "Add 'override' modifier", + newRangeContent: "override bar () {}", + index: 0 +}) diff --git a/tests/cases/fourslash/codeFixOverrideModifier4.ts b/tests/cases/fourslash/codeFixOverrideModifier4.ts new file mode 100644 index 0000000000000..1f541092d7f97 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier4.ts @@ -0,0 +1,17 @@ +/// + +// @pedanticOverride: true +//// class B { +//// foo (v: string) {} +//// fooo (v: string) {} +//// } +//// class D extends B { +//// override foo (v: string) {} +//// [|override bar(v: string) {}|] +//// } + +verify.codeFix({ + description: "Remove 'override' modifier", + newRangeContent: "bar(v: string) {}", + index: 0 +}) diff --git a/tests/cases/fourslash/codeFixOverrideModifier5.ts b/tests/cases/fourslash/codeFixOverrideModifier5.ts new file mode 100644 index 0000000000000..d516726b6b774 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier5.ts @@ -0,0 +1,13 @@ +/// + +// @pedanticOverride: true +//// class C { +//// [|override foo(v: string) {}|] +//// } + +verify.codeFix({ + description: "Remove 'override' modifier", + newRangeContent: "foo(v: string) {}", + index: 0 +}) + diff --git a/tests/cases/fourslash/codeFixOverrideModifier6.ts b/tests/cases/fourslash/codeFixOverrideModifier6.ts new file mode 100644 index 0000000000000..a160a8321a3dc --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier6.ts @@ -0,0 +1,20 @@ +/// + +// @pedanticOverride: true +//// class B { +//// foo (v: string) {} +//// fooo (v: string) {} +//// } +//// function f () { +//// return class extends B { +//// override foo (v: string) {} +//// [|override bar(v: string) {}|] +//// } +//// } + +verify.codeFix({ + description: "Remove 'override' modifier", + newRangeContent: 'bar(v: string) {}', + index: 0 +}) + diff --git a/tests/cases/fourslash/codeFixOverrideModifier7.ts b/tests/cases/fourslash/codeFixOverrideModifier7.ts new file mode 100644 index 0000000000000..2a4e3bb0091a9 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier7.ts @@ -0,0 +1,19 @@ +/// + +// @pedanticOverride: true +//// class E extends (class { +//// foo () {} +//// bar () {} +//// }) { +//// override foo () { } +//// baz() {} +//// [|override bazz () {}|] +//// } + + +verify.codeFix({ + description: "Remove 'override' modifier", + newRangeContent: "bazz () {}", + index: 0 +}) + diff --git a/tests/cases/fourslash/codeFixOverrideModifier8.ts b/tests/cases/fourslash/codeFixOverrideModifier8.ts new file mode 100644 index 0000000000000..747f75f6e9b34 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier8.ts @@ -0,0 +1,15 @@ +/// + +// @pedanticOverride: true +//// function ff () { +//// return class { +//// [|override foo () {}|] +//// } +//// } + +verify.codeFix({ + description: "Remove 'override' modifier", + newRangeContent: "foo () {}", + index: 0 +}) + diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts new file mode 100644 index 0000000000000..d4a7dd979ed07 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts @@ -0,0 +1,75 @@ +/// + +// @pedanticOverride: true +//// class B { +//// foo (v: string) {} +//// fooo (v: string) {} +//// } +//// class D extends B { +//// override foo (v: string) {} +//// fooo (v: string) {} +//// override bar(v: string) {} +//// } +//// class C { +//// override foo(v: string) {} +//// } +//// function f () { +//// return class extends B { +//// override foo (v: string) {} +//// fooo (v: string) {} +//// override bar(v: string) {} +//// } +//// } +//// class E extends (class { +//// foo () { } +//// bar () { } +//// }) { +//// override foo () { } +//// bar () { } +//// baz() {} +//// override bazz () {} +//// } +//// function ff () { +//// return class { +//// override foo () {} +//// } +//// } + +verify.codeFixAll({ + fixId: "fixAddOverrideModifier", + fixAllDescription: "Add all 'override' modifier", + newFileContent: `class B { + foo (v: string) {} + fooo (v: string) {} +} +class D extends B { + override foo (v: string) {} + override fooo (v: string) {} + override bar(v: string) {} +} +class C { + override foo(v: string) {} +} +function f () { + return class extends B { + override foo (v: string) {} + override fooo (v: string) {} + override bar(v: string) {} + } +} +class E extends (class { + foo () { } + bar () { } +}) { + override foo () { } + override bar () { } + baz() {} + override bazz () {} +} +function ff () { + return class { + override foo () {} + } +}` +}) + diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts new file mode 100644 index 0000000000000..13d75a9381dc8 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts @@ -0,0 +1,75 @@ +/// + +// @pedanticOverride: true +//// class B { +//// foo (v: string) {} +//// fooo (v: string) {} +//// } +//// class D extends B { +//// override foo (v: string) {} +//// fooo (v: string) {} +//// override bar(v: string) {} +//// } +//// class C { +//// override foo(v: string) {} +//// } +//// function f () { +//// return class extends B { +//// override foo (v: string) {} +//// fooo (v: string) {} +//// override bar(v: string) {} +//// } +//// } +//// class E extends (class { +//// foo () { } +//// bar () { } +//// }) { +//// override foo () { } +//// bar () { } +//// baz() {} +//// override bazz () {} +//// } +//// function ff () { +//// return class { +//// override foo () {} +//// } +//// } + +verify.codeFixAll({ + fixId: "fixRemoveOverrideModifier", + fixAllDescription: "Remove all 'override' modifier", + newFileContent: `class B { + foo (v: string) {} + fooo (v: string) {} +} +class D extends B { + override foo (v: string) {} + fooo (v: string) {} + bar(v: string) {} +} +class C { + foo(v: string) {} +} +function f () { + return class extends B { + override foo (v: string) {} + fooo (v: string) {} + bar(v: string) {} + } +} +class E extends (class { + foo () { } + bar () { } +}) { + override foo () { } + bar () { } + baz() {} + bazz () {} +} +function ff () { + return class { + foo () {} + } +}` +}) + From 2b57fbd95d605b95b96b2cf5acd3df5c537b5969 Mon Sep 17 00:00:00 2001 From: kingwl Date: Wed, 19 Aug 2020 18:11:26 +0800 Subject: [PATCH 18/61] simplify code --- src/services/codefixes/fixOverrideModifier.ts | 59 ++++++++----------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index fc4b5be6bfa12..163c4118380d2 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -11,10 +11,19 @@ namespace ts.codefix { Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option.code ]; - const errorCodeFixIdMap = { - [Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code]: fixAddOverrideId, - [Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code]: fixRemoveOverrideId, - [Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code]: fixRemoveOverrideId, + const errorCodeFixIdMap: Record = { + [Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code]: [ + Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Add_all_override_modifier, + ], + [Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code]: [ + Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier + ], + [Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code]: [ + Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier + ], + [Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option.code]: [ + Diagnostics.Enable_the_pedanticOverride_flag_in_your_configuration_file, undefined, undefined + ] }; registerCodeFix({ @@ -22,8 +31,11 @@ namespace ts.codefix { getCodeActions: context => { const { errorCode, span } = context; - const [changeFactory, descriptions, fixId, fixAllDescriptions] = dispatchChanges(context, errorCode, span.start); - const changes = textChanges.ChangeTracker.with(context, changeFactory); + const info = errorCodeFixIdMap[errorCode]; + if (!info) return emptyArray; + + const [ descriptions, fixId, fixAllDescriptions ] = info; + const changes = textChanges.ChangeTracker.with(context, changes => dispatchChanges(changes, context, errorCode, span.start)); return [ createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId, fixAllDescriptions) @@ -33,47 +45,28 @@ namespace ts.codefix { getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { const { code, start } = diag; - if (errorCodeFixIdMap[code] !== context.fixId) { + const info = errorCodeFixIdMap[code]; + if (!info || info[1] !== context.fixId) { return; } - const [changeFactory] = dispatchChanges(context, code, start); - changeFactory(changes); + dispatchChanges(changes, context, code, start); }) }); function dispatchChanges( + changeTracker: textChanges.ChangeTracker, context: CodeFixContext | CodeFixAllContext, errorCode: number, - pos: number): [ - changeFactory: (changeTracker: textChanges.ChangeTracker) => void, - descriptions: DiagnosticMessage, - fixId: string | undefined, - fixAllDescriptions: DiagnosticMessage | undefined - ] { + pos: number) { switch (errorCode) { case Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code: - return [ - (changeTracker: textChanges.ChangeTracker) => doAddOverrideModifierChange(changeTracker, context.sourceFile, pos), - Diagnostics.Add_override_modifier, - fixAddOverrideId, - Diagnostics.Add_all_override_modifier, - ]; + return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos); case Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code: case Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code: - return [ - (changeTracker: textChanges.ChangeTracker) => doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos), - Diagnostics.Remove_override_modifier, - fixRemoveOverrideId, - Diagnostics.Remove_all_override_modifier - ]; + return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos); case Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option.code: - return [ - (changeTracker: textChanges.ChangeTracker) => doAddFlagChange(changeTracker, context.program), - Diagnostics.Enable_the_pedanticOverride_flag_in_your_configuration_file, - undefined, - undefined - ]; + return doAddFlagChange(changeTracker, context.program); default: Debug.fail("Unexpected error code: " + errorCode); } From d34afb94e428287702e06746ba0dd9d3358809d7 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 20 Aug 2020 00:04:50 +0800 Subject: [PATCH 19/61] accept baseline --- .../baselines/reference/override7.errors.txt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/baselines/reference/override7.errors.txt b/tests/baselines/reference/override7.errors.txt index e1d19cd62d0b2..e26a65711e89f 100644 --- a/tests/baselines/reference/override7.errors.txt +++ b/tests/baselines/reference/override7.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/override/override7.ts(9,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option -tests/cases/conformance/override/override7.ts(11,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option -tests/cases/conformance/override/override7.ts(13,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option -tests/cases/conformance/override/override7.ts(15,12): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option -tests/cases/conformance/override/override7.ts(16,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option -tests/cases/conformance/override/override7.ts(18,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +tests/cases/conformance/override/override7.ts(9,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option +tests/cases/conformance/override/override7.ts(11,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option +tests/cases/conformance/override/override7.ts(13,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option +tests/cases/conformance/override/override7.ts(15,12): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option +tests/cases/conformance/override/override7.ts(16,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option +tests/cases/conformance/override/override7.ts(18,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option ==== tests/cases/conformance/override/override7.ts (6 errors) ==== @@ -17,26 +17,26 @@ tests/cases/conformance/override/override7.ts(18,5): error TS4114: 'Override' mo override declare p2: number ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option override static sp: number; ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option override override oop: number; ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option public override pp: number; ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option override public op: number; ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option override constructor () { ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride ' compiler option +!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option super(); } } From b4614d15f78cef139c4bf20caf78150fb39b12ab Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 21 Aug 2020 15:39:18 +0800 Subject: [PATCH 20/61] Update desc --- src/compiler/checker.ts | 13 +++----- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticMessages.json | 12 +++---- src/services/codefixes/fixOverrideModifier.ts | 33 +++++-------------- .../baselines/reference/override1.errors.txt | 32 +++++++++--------- .../baselines/reference/override2.errors.txt | 8 ++--- .../baselines/reference/override3.errors.txt | 4 +-- .../baselines/reference/override4.errors.txt | 16 ++++----- .../baselines/reference/override5.errors.txt | 4 +-- .../baselines/reference/override6.errors.txt | 4 +-- .../baselines/reference/override7.errors.txt | 23 +++---------- .../codeFixOverrideEnableOverrideFlag.ts | 24 -------------- 12 files changed, 57 insertions(+), 118 deletions(-) delete mode 100644 tests/cases/fourslash/codeFixOverrideEnableOverrideFlag.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2143e6acb6e7a..768049b1f4287 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34516,7 +34516,7 @@ namespace ts { } if (compilerOptions.pedanticOverride && !nodeInAmbientContext) { - issueMemberWithOverride(node, type, typeWithThis); + checkMembersForMissingOverrideModifier(node, type, typeWithThis); } const implementedTypeNodes = getEffectiveImplementsTypeNodes(node); @@ -34553,7 +34553,7 @@ namespace ts { } } - function issueMemberWithOverride(node: ClassLikeDeclaration, type: InterfaceType, typeWithThis: Type) { + function checkMembersForMissingOverrideModifier(node: ClassLikeDeclaration, type: InterfaceType, typeWithThis: Type) { const baseTypeNode = getEffectiveBaseTypeNode(node); const baseTypes = baseTypeNode && getBaseTypes(type); const baseWithThis = baseTypes?.length ? getTypeWithThisArgument(first(baseTypes), type.thisType) : undefined; @@ -34567,16 +34567,16 @@ namespace ts { const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); if (prop && !baseProp && hasOverride) { - error(member, Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0, baseClassName); + error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); } else if (prop && baseProp && !hasOverride) { - error(member, Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0, baseClassName); + error(member, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0, baseClassName); } } } else if (hasOverride) { const className = typeToString(type); - error(member, Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class, className); + error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className); } } } @@ -37909,9 +37909,6 @@ namespace ts { } break; case SyntaxKind.OverrideKeyword: - if (!compilerOptions.pedanticOverride) { - return grammarErrorOnNode(modifier, Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option); - } if (flags & ModifierFlags.Override) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override"); } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index cf72d7d80de97..1e2e1205cb972 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -612,7 +612,7 @@ namespace ts { affectsSemanticDiagnostics: true, showInSimplifiedHelpView: false, category: Diagnostics.Additional_Checks, - description: Diagnostics.Required_override_modifier_in_class_element + description: Diagnostics.Force_overriding_members_in_derived_classes_to_be_marked_with_an_override_modifier }, // Module Resolution diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1cac38d982eb0..7e120c06beeaa 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3386,22 +3386,18 @@ "category": "Error", "code": 4110 }, - "Class member cannot have override modifier because class '{0}' does not extended another class.": { + "This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class.": { "category": "Error", "code": 4111 }, - "Class member cannot have override modifier because it's not existed in the base class '{0}'.": { + "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'.": { "category": "Error", "code": 4112 }, - "Class member must have override modifier because it's override the base class '{0}'.": { + "This member must have an 'override' modifier because it overrides a member in the base class '{0}'.": { "category": "Error", "code": 4113 }, - "'Override' modifier must be used with 'pedanticOverride' compiler option": { - "category": "Error", - "code": 4114 - }, "The current host does not support the '{0}' option.": { "category": "Error", @@ -4702,7 +4698,7 @@ "category": "Error", "code": 6504 }, - "Required override modifier in class element": { + "Force overriding members in derived classes to be marked with an 'override' modifier.": { "category": "Error", "code": 6801 }, diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index 163c4118380d2..55d12c0bb3e70 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -5,24 +5,20 @@ namespace ts.codefix { const fixRemoveOverrideId = "fixRemoveOverrideModifier"; const errorCodes = [ - Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code, - Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code, - Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code, - Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option.code + Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code, + Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, + Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code, ]; const errorCodeFixIdMap: Record = { - [Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code]: [ + [Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code]: [ Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Add_all_override_modifier, ], - [Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code]: [ + [Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code]: [ Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier ], - [Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code]: [ + [Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]: [ Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier - ], - [Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option.code]: [ - Diagnostics.Enable_the_pedanticOverride_flag_in_your_configuration_file, undefined, undefined ] }; @@ -60,27 +56,16 @@ namespace ts.codefix { errorCode: number, pos: number) { switch (errorCode) { - case Diagnostics.Class_member_must_have_override_modifier_because_it_s_override_the_base_class_0.code: + case Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code: return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos); - case Diagnostics.Class_member_cannot_have_override_modifier_because_class_0_does_not_extended_another_class.code: - case Diagnostics.Class_member_cannot_have_override_modifier_because_it_s_not_existed_in_the_base_class_0.code: + case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code: + case Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code: return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos); - case Diagnostics.Override_modifier_must_be_used_with_pedanticOverride_compiler_option.code: - return doAddFlagChange(changeTracker, context.program); default: Debug.fail("Unexpected error code: " + errorCode); } } - function doAddFlagChange(changeTracker: textChanges.ChangeTracker, program: Program) { - const { configFile } = program.getCompilerOptions(); - if (configFile === undefined) { - return undefined; - } - - setJsonCompilerOptionValue(changeTracker, configFile, "pedanticOverride", factory.createTrue()); - } - function doAddOverrideModifierChange(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) { const classElement = findContainerClassElement(sourceFile, pos); changeTracker.insertLastModifierBefore(sourceFile, SyntaxKind.OverrideKeyword, classElement); diff --git a/tests/baselines/reference/override1.errors.txt b/tests/baselines/reference/override1.errors.txt index 7e35d3aec567e..afe6575828def 100644 --- a/tests/baselines/reference/override1.errors.txt +++ b/tests/baselines/reference/override1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/override/override1.ts(9,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override1.ts(11,14): error TS4112: Class member cannot have override modifier because it's not existed in the base class 'B'. -tests/cases/conformance/override/override1.ts(15,14): error TS4111: Class member cannot have override modifier because class 'C' does not extended another class. -tests/cases/conformance/override/override1.ts(22,9): error TS4113: Class member must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override1.ts(24,18): error TS4112: Class member cannot have override modifier because it's not existed in the base class 'B'. -tests/cases/conformance/override/override1.ts(33,5): error TS4113: Class member must have override modifier because it's override the base class '(Anonymous class)'. -tests/cases/conformance/override/override1.ts(37,14): error TS4112: Class member cannot have override modifier because it's not existed in the base class '(Anonymous class)'. -tests/cases/conformance/override/override1.ts(42,18): error TS4111: Class member cannot have override modifier because class '(Anonymous class)' does not extended another class. +tests/cases/conformance/override/override1.ts(9,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override1.ts(11,14): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override1.ts(15,14): error TS4111: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. +tests/cases/conformance/override/override1.ts(22,9): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override1.ts(24,18): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override1.ts(33,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class '(Anonymous class)'. +tests/cases/conformance/override/override1.ts(37,14): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class '(Anonymous class)'. +tests/cases/conformance/override/override1.ts(42,18): error TS4111: This member cannot have an 'override' modifier because its containing class '(Anonymous class)' does not extend another class. ==== tests/cases/conformance/override/override1.ts (8 errors) ==== @@ -19,17 +19,17 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: Class member fooo (v: string) {} ~~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override bar(v: string) {} ~~~ -!!! error TS4112: Class member cannot have override modifier because it's not existed in the base class 'B'. +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. } class C { override foo(v: string) {} ~~~ -!!! error TS4111: Class member cannot have override modifier because class 'C' does not extended another class. +!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. } function f () { @@ -38,11 +38,11 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: Class member fooo (v: string) {} ~~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override bar(v: string) {} ~~~ -!!! error TS4112: Class member cannot have override modifier because it's not existed in the base class 'B'. +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. } } @@ -53,19 +53,19 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: Class member override foo () { } bar () { } ~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class '(Anonymous class)'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class '(Anonymous class)'. baz() {} override bazz () {} ~~~~ -!!! error TS4112: Class member cannot have override modifier because it's not existed in the base class '(Anonymous class)'. +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class '(Anonymous class)'. } function ff () { return class { override foo () {} ~~~ -!!! error TS4111: Class member cannot have override modifier because class '(Anonymous class)' does not extended another class. +!!! error TS4111: This member cannot have an 'override' modifier because its containing class '(Anonymous class)' does not extend another class. } } \ No newline at end of file diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt index aa2fe34aedaeb..cdf4888455268 100644 --- a/tests/baselines/reference/override2.errors.txt +++ b/tests/baselines/reference/override2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/override/override2.ts(12,14): error TS4113: Class member must have override modifier because it's override the base class 'AB'. -tests/cases/conformance/override/override2.ts(17,14): error TS4113: Class member must have override modifier because it's override the base class 'AB'. +tests/cases/conformance/override/override2.ts(12,14): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. +tests/cases/conformance/override/override2.ts(17,14): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. ==== tests/cases/conformance/override/override2.ts (2 errors) ==== @@ -16,14 +16,14 @@ tests/cases/conformance/override/override2.ts(17,14): error TS4113: Class member abstract class AD2 extends AB { abstract foo(v: ''): void // need override? ~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'AB'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. } abstract class AD3 extends AB { override foo(v: ''): void { } // need override? abstract bar(): void; ~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'AB'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. } class D4 extends AB { diff --git a/tests/baselines/reference/override3.errors.txt b/tests/baselines/reference/override3.errors.txt index 2f05f1a81d4eb..30a26d4181fed 100644 --- a/tests/baselines/reference/override3.errors.txt +++ b/tests/baselines/reference/override3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override3.ts(22,5): error TS4113: Class member must have override modifier because it's override the base class 'D'. +tests/cases/conformance/override/override3.ts(22,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'D'. ==== tests/cases/conformance/override/override3.ts (1 errors) ==== @@ -25,7 +25,7 @@ tests/cases/conformance/override/override3.ts(22,5): error TS4113: Class member class EB extends D { foo(): void {} ~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'D'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'D'. override bar(): void {} } \ No newline at end of file diff --git a/tests/baselines/reference/override4.errors.txt b/tests/baselines/reference/override4.errors.txt index cc4257f41c93c..7b66a1e1e1cab 100644 --- a/tests/baselines/reference/override4.errors.txt +++ b/tests/baselines/reference/override4.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/override/override4.ts(11,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override4.ts(13,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override4.ts(17,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. -tests/cases/conformance/override/override4.ts(23,5): error TS4113: Class member must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override4.ts(11,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override4.ts(13,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override4.ts(17,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override4.ts(23,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. ==== tests/cases/conformance/override/override4.ts (4 errors) ==== @@ -17,17 +17,17 @@ tests/cases/conformance/override/override4.ts(23,5): error TS4113: Class member class D extends B { p1: number = 2; ~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override p2: number = 3; p3: () => void; ~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override p4: () => void; override foo (v: string) {} fooo (v: string) {} ~~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. } @@ -35,5 +35,5 @@ tests/cases/conformance/override/override4.ts(23,5): error TS4113: Class member override foo: () => void fooo: () => void; ~~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. } \ No newline at end of file diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt index 215ef8b68787e..d2c7e4e34761a 100644 --- a/tests/baselines/reference/override5.errors.txt +++ b/tests/baselines/reference/override5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override5.ts(10,13): error TS4113: Class member must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override5.ts(10,13): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. tests/cases/conformance/override/override5.ts(12,14): error TS1040: 'override' modifier cannot be used in an ambient context. tests/cases/conformance/override/override5.ts(14,14): error TS1243: 'static' modifier cannot be used with 'override' modifier. tests/cases/conformance/override/override5.ts(16,14): error TS1030: 'override' modifier already seen. @@ -18,7 +18,7 @@ tests/cases/conformance/override/override5.ts(21,5): error TS1089: 'override' mo class D extends B{ declare p1: number ~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override declare p2: number ~~~~~~~ diff --git a/tests/baselines/reference/override6.errors.txt b/tests/baselines/reference/override6.errors.txt index 24ba41474beb8..a1d7475d782d1 100644 --- a/tests/baselines/reference/override6.errors.txt +++ b/tests/baselines/reference/override6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override6.ts(9,12): error TS4113: Class member must have override modifier because it's override the base class 'B'. +tests/cases/conformance/override/override6.ts(9,12): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. ==== tests/cases/conformance/override/override6.ts (1 errors) ==== @@ -12,7 +12,7 @@ tests/cases/conformance/override/override6.ts(9,12): error TS4113: Class member class D extends B { public bar: number = 1 ~~~ -!!! error TS4113: Class member must have override modifier because it's override the base class 'B'. +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. constructor(public foo: string, public baz: number) { super(foo, 42) } diff --git a/tests/baselines/reference/override7.errors.txt b/tests/baselines/reference/override7.errors.txt index e26a65711e89f..b2fef4b63b511 100644 --- a/tests/baselines/reference/override7.errors.txt +++ b/tests/baselines/reference/override7.errors.txt @@ -1,12 +1,7 @@ -tests/cases/conformance/override/override7.ts(9,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option -tests/cases/conformance/override/override7.ts(11,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option -tests/cases/conformance/override/override7.ts(13,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option -tests/cases/conformance/override/override7.ts(15,12): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option -tests/cases/conformance/override/override7.ts(16,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option -tests/cases/conformance/override/override7.ts(18,5): error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option +tests/cases/conformance/override/override7.ts(13,14): error TS1030: 'override' modifier already seen. -==== tests/cases/conformance/override/override7.ts (6 errors) ==== +==== tests/cases/conformance/override/override7.ts (1 errors) ==== class B { p1: number = 1; p2: number = 2; @@ -16,27 +11,17 @@ tests/cases/conformance/override/override7.ts(18,5): error TS4114: 'Override' mo declare p1: number override declare p2: number - ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option override static sp: number; - ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option override override oop: number; - ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option + ~~~~~~~~ +!!! error TS1030: 'override' modifier already seen. public override pp: number; - ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option override public op: number; - ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option override constructor () { - ~~~~~~~~ -!!! error TS4114: 'Override' modifier must be used with 'pedanticOverride' compiler option super(); } } diff --git a/tests/cases/fourslash/codeFixOverrideEnableOverrideFlag.ts b/tests/cases/fourslash/codeFixOverrideEnableOverrideFlag.ts deleted file mode 100644 index 48c5f178a5ef9..0000000000000 --- a/tests/cases/fourslash/codeFixOverrideEnableOverrideFlag.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @Filename: /dir/a.ts -//// class B { foo () {} } -//// class D extends B { override foo () {} } - -// @Filename: /dir/tsconfig.json -////{ -//// "compilerOptions": { -//// } -////} - -goTo.file("/dir/a.ts"); -verify.codeFix({ - description: "Enable the '--pedanticOverride' flag in your configuration file", - newFileContent: { - "/dir/tsconfig.json": -`{ - "compilerOptions": { - "pedanticOverride": true - } -}`, - }, -}); From 1ef034d54d2fbc867f6569da9303c15f2adadffe Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 21 Aug 2020 15:55:05 +0800 Subject: [PATCH 21/61] Accept baseline --- .../tsConfig/Default initialized TSConfig/tsconfig.json | 2 +- .../Initialized TSConfig with advanced options/tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../Initialized TSConfig with files options/tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../declarationDir-is-specified.js | 2 +- .../when-outDir-and-declarationDir-is-specified.js | 2 +- .../when-outDir-is-specified.js | 2 +- .../with-outFile.js | 2 +- ...t-outDir-or-outFile-is-specified-with-declaration-enabled.js | 2 +- .../without-outDir-or-outFile-is-specified.js | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index 654c8f6cbfb2d..9d1880e47f1f5 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index a3d2a8b944cee..bfffdb7834227 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index b82f10f9debfd..4c3bccad26f9d 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 3ea917ab123b5..a38bfcea31102 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index b1da31b267295..7be6dc630b8df 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 034bb16cd7a87..42eb1b940e9bf 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 654c8f6cbfb2d..9d1880e47f1f5 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 53bfbf81e6448..91eaba551ec38 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index c985cacfdcb01..83454d604f9cf 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -39,7 +39,7 @@ // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js index 749094c452430..b94b0d21a4398 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js @@ -60,7 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js index 22d44534d98e8..c3cc8369d1254 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js @@ -60,7 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js index 7ba10b2b850f1..a4fa13b665c4f 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js @@ -60,7 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js index 9a525da094185..6ae65276da2f9 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js @@ -60,7 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js index aba85addbbb05..6ae997be7d3e9 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js @@ -60,7 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js index 1401615fe779e..8716fde53b83f 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js @@ -60,7 +60,7 @@ interface Array { length: number; [n: number]: T; } // "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "pedanticOverride": true, /* Required override modifier in class element */ + // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ From aebfb28bd63518ff3cba6ae165d57aee57d561cc Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 24 Aug 2020 13:25:30 +0800 Subject: [PATCH 22/61] Add override completions --- src/compiler/utilitiesPublic.ts | 2 +- .../fourslash/completionsWithOverride1.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionsWithOverride1.ts diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index e624453a2e787..24b70679350b2 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1142,7 +1142,7 @@ namespace ts { /* @internal */ export function isClassMemberModifier(idToken: SyntaxKind): boolean { - return isParameterPropertyModifier(idToken) || idToken === SyntaxKind.StaticKeyword; + return isParameterPropertyModifier(idToken) || idToken === SyntaxKind.StaticKeyword || idToken === SyntaxKind.OverrideKeyword; } export function isModifier(node: Node): node is Modifier { diff --git a/tests/cases/fourslash/completionsWithOverride1.ts b/tests/cases/fourslash/completionsWithOverride1.ts new file mode 100644 index 0000000000000..f78fb4c95849c --- /dev/null +++ b/tests/cases/fourslash/completionsWithOverride1.ts @@ -0,0 +1,18 @@ +/// + +//// class A { +//// foo () {} +//// bar () {} +//// } +//// class B extends A { +//// override /*1*/ +//// } + +verify.completions({ + marker: "1", + includes: [ + "foo", + "bar" + ], + isNewIdentifierLocation: true +}) From 7753983ad488f1e50e76bd82a3ce96eb59d5f865 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 24 Aug 2020 13:41:16 +0800 Subject: [PATCH 23/61] filter out implements field in override context --- src/services/completions.ts | 6 ++++- .../fourslash/completionsWithOverride2.ts | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionsWithOverride2.ts diff --git a/src/services/completions.ts b/src/services/completions.ts index 2bec3132df955..055d50db13b3e 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -2017,13 +2017,17 @@ namespace ts.Completions { case "static": classElementModifierFlags = classElementModifierFlags | ModifierFlags.Static; break; + case "override": + classElementModifierFlags = classElementModifierFlags | ModifierFlags.Override; + break; } } // No member list for private methods if (!(classElementModifierFlags & ModifierFlags.Private)) { // List of property symbols of base type that are not private and already implemented - const baseSymbols = flatMap(getAllSuperTypeNodes(decl), baseTypeNode => { + const baseTypeNodes = classElementModifierFlags & ModifierFlags.Override ? singleElementArray(getEffectiveBaseTypeNode(decl)) : getAllSuperTypeNodes(decl); + const baseSymbols = flatMap(baseTypeNodes, baseTypeNode => { const type = typeChecker.getTypeAtLocation(baseTypeNode); return classElementModifierFlags & ModifierFlags.Static ? type?.symbol && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : diff --git a/tests/cases/fourslash/completionsWithOverride2.ts b/tests/cases/fourslash/completionsWithOverride2.ts new file mode 100644 index 0000000000000..6fce32208b653 --- /dev/null +++ b/tests/cases/fourslash/completionsWithOverride2.ts @@ -0,0 +1,24 @@ +/// + +//// interface I { +//// baz () {} +//// } +//// class A { +//// foo () {} +//// bar () {} +//// } +//// class B extends A implements I { +//// override /*1*/ +//// } + +verify.completions({ + marker: "1", + includes: [ + "foo", + "bar" + ], + excludes: [ + "baz" + ], + isNewIdentifierLocation: true +}) From 5c04ccc7f76b8c7f08213a56f1c69771cfe6fdf0 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 24 Aug 2020 13:58:37 +0800 Subject: [PATCH 24/61] fix tests --- src/harness/fourslashInterfaceImpl.ts | 2 +- src/services/completions.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index d1413d75cddbe..7d969feab8c2b 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1091,7 +1091,7 @@ namespace FourSlashInterface { } export const classElementKeywords: readonly ExpectedCompletionEntryObject[] = - ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set"].map(keywordEntry); + ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set", "override"].map(keywordEntry); export const classElementInJsKeywords = getInJsKeywords(classElementKeywords); diff --git a/src/services/completions.ts b/src/services/completions.ts index 055d50db13b3e..16ced7b267c70 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -2026,7 +2026,7 @@ namespace ts.Completions { // No member list for private methods if (!(classElementModifierFlags & ModifierFlags.Private)) { // List of property symbols of base type that are not private and already implemented - const baseTypeNodes = classElementModifierFlags & ModifierFlags.Override ? singleElementArray(getEffectiveBaseTypeNode(decl)) : getAllSuperTypeNodes(decl); + const baseTypeNodes = isClassLike(decl) && classElementModifierFlags & ModifierFlags.Override ? singleElementArray(getEffectiveBaseTypeNode(decl)) : getAllSuperTypeNodes(decl); const baseSymbols = flatMap(baseTypeNodes, baseTypeNode => { const type = typeChecker.getTypeAtLocation(baseTypeNode); return classElementModifierFlags & ModifierFlags.Static ? @@ -2609,6 +2609,7 @@ namespace ts.Completions { case SyntaxKind.NeverKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.ObjectKeyword: + case SyntaxKind.OverrideKeyword: case SyntaxKind.PrivateKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.PublicKeyword: @@ -2636,6 +2637,7 @@ namespace ts.Completions { case SyntaxKind.SetKeyword: case SyntaxKind.AsyncKeyword: case SyntaxKind.DeclareKeyword: + case SyntaxKind.OverrideKeyword: return true; default: return isClassMemberModifier(kind); From add16c962bccdf2c10f071730683352c2c7b87e7 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 24 Aug 2020 15:33:11 +0800 Subject: [PATCH 25/61] Add parameter property check --- src/compiler/checker.ts | 15 ++- src/compiler/diagnosticMessages.json | 4 + .../baselines/reference/override8.errors.txt | 42 +++++++ tests/baselines/reference/override8.js | 108 ++++++++++++++++++ tests/baselines/reference/override8.symbols | 64 +++++++++++ tests/baselines/reference/override8.types | 68 +++++++++++ tests/cases/conformance/override/override8.ts | 32 ++++++ 7 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/override8.errors.txt create mode 100644 tests/baselines/reference/override8.js create mode 100644 tests/baselines/reference/override8.symbols create mode 100644 tests/baselines/reference/override8.types create mode 100644 tests/cases/conformance/override/override8.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 768049b1f4287..1ef39300bda38 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34559,6 +34559,16 @@ namespace ts { const baseWithThis = baseTypes?.length ? getTypeWithThisArgument(first(baseTypes), type.thisType) : undefined; for (const member of node.members) { + if (isConstructorDeclaration(member)) { + forEach(member.parameters, param => { + if (isParameterPropertyDeclaration(param, member)) { + checkClassMember(param, /*memberIsParameterProperty*/ true); + } + }); + } + checkClassMember(member); + } + function checkClassMember(member: ClassElement | ParameterPropertyDeclaration, memberIsParameterProperty?: boolean) { const hasOverride = hasOverrideModifier(member); if (baseWithThis) { const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); @@ -34570,7 +34580,10 @@ namespace ts { error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); } else if (prop && baseProp && !hasOverride) { - error(member, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0, baseClassName); + const diag = memberIsParameterProperty ? + Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0 : + Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; + error(member, diag, baseClassName); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7e120c06beeaa..cd14012276312 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3398,6 +3398,10 @@ "category": "Error", "code": 4113 }, + "This parameter must convert into property declaration because it overrides a member in the base class '{0}'.": { + "category": "Error", + "code": 4114 + }, "The current host does not support the '{0}' option.": { "category": "Error", diff --git a/tests/baselines/reference/override8.errors.txt b/tests/baselines/reference/override8.errors.txt new file mode 100644 index 0000000000000..07736c67f66eb --- /dev/null +++ b/tests/baselines/reference/override8.errors.txt @@ -0,0 +1,42 @@ +tests/cases/conformance/override/override8.ts(6,17): error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override8.ts(18,17): error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'BB'. +tests/cases/conformance/override/override8.ts(24,12): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'BB'. + + +==== tests/cases/conformance/override/override8.ts (3 errors) ==== + class B { + a: string + } + + class D extends B { + constructor(public a: string, public b: string) { + ~~~~~~~~~~~~~~~~ +!!! error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. + super(); + } + } + + class BB { + constructor(public a: string) { + + } + } + + class DD extends BB { + constructor(public a: string) { + ~~~~~~~~~~~~~~~~ +!!! error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'BB'. + super(a) + } + } + + class DDD extends BB { + public a: string; + ~ +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'BB'. + + constructor(a: string) { + super(a) + this.a = a + } + } \ No newline at end of file diff --git a/tests/baselines/reference/override8.js b/tests/baselines/reference/override8.js new file mode 100644 index 0000000000000..c3ed7da4f79cb --- /dev/null +++ b/tests/baselines/reference/override8.js @@ -0,0 +1,108 @@ +//// [override8.ts] +class B { + a: string +} + +class D extends B { + constructor(public a: string, public b: string) { + super(); + } +} + +class BB { + constructor(public a: string) { + + } +} + +class DD extends BB { + constructor(public a: string) { + super(a) + } +} + +class DDD extends BB { + public a: string; + + constructor(a: string) { + super(a) + this.a = a + } +} + +//// [override8.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var B = /** @class */ (function () { + function B() { + } + return B; +}()); +var D = /** @class */ (function (_super) { + __extends(D, _super); + function D(a, b) { + var _this = _super.call(this) || this; + _this.a = a; + _this.b = b; + return _this; + } + return D; +}(B)); +var BB = /** @class */ (function () { + function BB(a) { + this.a = a; + } + return BB; +}()); +var DD = /** @class */ (function (_super) { + __extends(DD, _super); + function DD(a) { + var _this = _super.call(this, a) || this; + _this.a = a; + return _this; + } + return DD; +}(BB)); +var DDD = /** @class */ (function (_super) { + __extends(DDD, _super); + function DDD(a) { + var _this = _super.call(this, a) || this; + _this.a = a; + return _this; + } + return DDD; +}(BB)); + + +//// [override8.d.ts] +declare class B { + a: string; +} +declare class D extends B { + a: string; + b: string; + constructor(a: string, b: string); +} +declare class BB { + a: string; + constructor(a: string); +} +declare class DD extends BB { + a: string; + constructor(a: string); +} +declare class DDD extends BB { + a: string; + constructor(a: string); +} diff --git a/tests/baselines/reference/override8.symbols b/tests/baselines/reference/override8.symbols new file mode 100644 index 0000000000000..244a02871e2dc --- /dev/null +++ b/tests/baselines/reference/override8.symbols @@ -0,0 +1,64 @@ +=== tests/cases/conformance/override/override8.ts === +class B { +>B : Symbol(B, Decl(override8.ts, 0, 0)) + + a: string +>a : Symbol(B.a, Decl(override8.ts, 0, 9)) +} + +class D extends B { +>D : Symbol(D, Decl(override8.ts, 2, 1)) +>B : Symbol(B, Decl(override8.ts, 0, 0)) + + constructor(public a: string, public b: string) { +>a : Symbol(D.a, Decl(override8.ts, 5, 16)) +>b : Symbol(D.b, Decl(override8.ts, 5, 33)) + + super(); +>super : Symbol(B, Decl(override8.ts, 0, 0)) + } +} + +class BB { +>BB : Symbol(BB, Decl(override8.ts, 8, 1)) + + constructor(public a: string) { +>a : Symbol(BB.a, Decl(override8.ts, 11, 16)) + + } +} + +class DD extends BB { +>DD : Symbol(DD, Decl(override8.ts, 14, 1)) +>BB : Symbol(BB, Decl(override8.ts, 8, 1)) + + constructor(public a: string) { +>a : Symbol(DD.a, Decl(override8.ts, 17, 16)) + + super(a) +>super : Symbol(BB, Decl(override8.ts, 8, 1)) +>a : Symbol(a, Decl(override8.ts, 17, 16)) + } +} + +class DDD extends BB { +>DDD : Symbol(DDD, Decl(override8.ts, 20, 1)) +>BB : Symbol(BB, Decl(override8.ts, 8, 1)) + + public a: string; +>a : Symbol(DDD.a, Decl(override8.ts, 22, 22)) + + constructor(a: string) { +>a : Symbol(a, Decl(override8.ts, 25, 16)) + + super(a) +>super : Symbol(BB, Decl(override8.ts, 8, 1)) +>a : Symbol(a, Decl(override8.ts, 25, 16)) + + this.a = a +>this.a : Symbol(DDD.a, Decl(override8.ts, 22, 22)) +>this : Symbol(DDD, Decl(override8.ts, 20, 1)) +>a : Symbol(DDD.a, Decl(override8.ts, 22, 22)) +>a : Symbol(a, Decl(override8.ts, 25, 16)) + } +} diff --git a/tests/baselines/reference/override8.types b/tests/baselines/reference/override8.types new file mode 100644 index 0000000000000..564ab8fbd76fb --- /dev/null +++ b/tests/baselines/reference/override8.types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/override/override8.ts === +class B { +>B : B + + a: string +>a : string +} + +class D extends B { +>D : D +>B : B + + constructor(public a: string, public b: string) { +>a : string +>b : string + + super(); +>super() : void +>super : typeof B + } +} + +class BB { +>BB : BB + + constructor(public a: string) { +>a : string + + } +} + +class DD extends BB { +>DD : DD +>BB : BB + + constructor(public a: string) { +>a : string + + super(a) +>super(a) : void +>super : typeof BB +>a : string + } +} + +class DDD extends BB { +>DDD : DDD +>BB : BB + + public a: string; +>a : string + + constructor(a: string) { +>a : string + + super(a) +>super(a) : void +>super : typeof BB +>a : string + + this.a = a +>this.a = a : string +>this.a : string +>this : this +>a : string +>a : string + } +} diff --git a/tests/cases/conformance/override/override8.ts b/tests/cases/conformance/override/override8.ts new file mode 100644 index 0000000000000..fbeb407778725 --- /dev/null +++ b/tests/cases/conformance/override/override8.ts @@ -0,0 +1,32 @@ +// @declaration: true +// @pedanticOverride: true +class B { + a: string +} + +class D extends B { + constructor(public a: string, public b: string) { + super(); + } +} + +class BB { + constructor(public a: string) { + + } +} + +class DD extends BB { + constructor(public a: string) { + super(a) + } +} + +class DDD extends BB { + public a: string; + + constructor(a: string) { + super(a) + this.a = a + } +} \ No newline at end of file From 5316e2f88f24630ed2ae3e2ed0413acb3ad21a9e Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 24 Aug 2020 15:41:52 +0800 Subject: [PATCH 26/61] Accept baseline --- src/harness/fourslashInterfaceImpl.ts | 1 + tests/cases/fourslash/completionEntryForClassMembers.ts | 2 +- tests/cases/fourslash/completionListInNamedClassExpression.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 7d969feab8c2b..355628081f566 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1080,6 +1080,7 @@ namespace FourSlashInterface { case "symbol": case "type": case "unique": + case "override": case "unknown": case "global": case "bigint": diff --git a/tests/cases/fourslash/completionEntryForClassMembers.ts b/tests/cases/fourslash/completionEntryForClassMembers.ts index d0023dc15f4f6..57c23f5649f66 100644 --- a/tests/cases/fourslash/completionEntryForClassMembers.ts +++ b/tests/cases/fourslash/completionEntryForClassMembers.ts @@ -146,7 +146,7 @@ verify.completions( "classThatStartedWritingIdentifierAfterPrivateModifier", "classThatStartedWritingIdentifierAfterPrivateStaticModifier", ], - exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set"].map( + exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set", "override"].map( name => ({ name, sortText: completion.SortText.GlobalsOrKeywords }) ), isNewIdentifierLocation: true, diff --git a/tests/cases/fourslash/completionListInNamedClassExpression.ts b/tests/cases/fourslash/completionListInNamedClassExpression.ts index 68d994ca2c117..d69a607bc4642 100644 --- a/tests/cases/fourslash/completionListInNamedClassExpression.ts +++ b/tests/cases/fourslash/completionListInNamedClassExpression.ts @@ -11,7 +11,7 @@ verify.completions( { marker: "0", includes: { name: "myClass", text: "(local class) myClass", kind: "local class" } }, { marker: "1", - exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set"].map( + exact: ["private", "protected", "public", "static", "abstract", "async", "constructor", "declare", "get", "readonly", "set", "override"].map( name => ({ name, sortText: completion.SortText.GlobalsOrKeywords }) ), isNewIdentifierLocation: true, From f36fede64b4d803296e397b0b243c8e5018c2095 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 24 Aug 2020 18:44:30 +0800 Subject: [PATCH 27/61] acept baseline --- tests/baselines/reference/override6.errors.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/baselines/reference/override6.errors.txt b/tests/baselines/reference/override6.errors.txt index a1d7475d782d1..a71742252f0a6 100644 --- a/tests/baselines/reference/override6.errors.txt +++ b/tests/baselines/reference/override6.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/override/override6.ts(9,12): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override6.ts(10,17): error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override6.ts(10,37): error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. -==== tests/cases/conformance/override/override6.ts (1 errors) ==== +==== tests/cases/conformance/override/override6.ts (3 errors) ==== class B { public baz: number = 1; constructor(public foo: string, public bar: number) { @@ -14,6 +16,10 @@ tests/cases/conformance/override/override6.ts(9,12): error TS4113: This member m ~~~ !!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. constructor(public foo: string, public baz: number) { + ~~~~~~~~~~~~~~~~~~ +!!! error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. + ~~~~~~~~~~~~~~~~~~ +!!! error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. super(foo, 42) } } From 811bd1e9f020ebae619e228e5582938b26a801d5 Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 25 Aug 2020 15:02:14 +0800 Subject: [PATCH 28/61] Add parameter property to declaration code action --- src/compiler/utilities.ts | 4 + src/services/codefixes/generateAccessors.ts | 4 - .../parameterPropertyToDeclaration.ts | 90 +++++++++++++++++++ src/services/textChanges.ts | 10 +++ src/services/tsconfig.json | 1 + 5 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 src/services/codefixes/parameterPropertyToDeclaration.ts diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a166eef5db3ff..9715ea051c910 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4667,6 +4667,10 @@ namespace ts { return ModifierFlags.None; } + export function createModifiers(modifierFlags: ModifierFlags): ModifiersArray | undefined { + return modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; + } + export function isLogicalOperator(token: SyntaxKind): boolean { return token === SyntaxKind.BarBarToken || token === SyntaxKind.AmpersandAmpersandToken diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index 518278d041c12..b8f8785e075e6 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -90,10 +90,6 @@ namespace ts.codefix { return isIdentifier(fieldName) ? factory.createPropertyAccessExpression(leftHead, fieldName) : factory.createElementAccessExpression(leftHead, factory.createStringLiteralFromNode(fieldName)); } - function createModifiers(modifierFlags: ModifierFlags): ModifiersArray | undefined { - return modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - function prepareModifierFlagsForAccessor(modifierFlags: ModifierFlags): ModifierFlags { modifierFlags &= ~ModifierFlags.Readonly; // avoid Readonly modifier because it will convert to get accessor modifierFlags &= ~ModifierFlags.Private; diff --git a/src/services/codefixes/parameterPropertyToDeclaration.ts b/src/services/codefixes/parameterPropertyToDeclaration.ts new file mode 100644 index 0000000000000..a1aa4ef6a919b --- /dev/null +++ b/src/services/codefixes/parameterPropertyToDeclaration.ts @@ -0,0 +1,90 @@ +/* @internal */ +namespace ts.codefix { + interface ParameterPropertyToPropertyInfo { + parameter: ParameterPropertyDeclaration + ctor: ConstructorDeclaration + container: ClassLikeDeclaration + } + export function rangeContainsSkipTrivia(r1: TextRange, node: Node, file: SourceFile): boolean { + return rangeContainsStartEnd(r1, skipTrivia(file.text, node.pos), node.end); + } + + export function getConvertParameterPropertyToPropertyInfo(file: SourceFile, start: number, end?: number) { + const current = getTokenAtPosition(file, start); + const range = end && createTextRangeFromSpan(createTextSpan(start, end)); + + let maybeVariableName: Identifier | undefined; + let parameter = findAncestor(current, node => { + if (range && !rangeContainsSkipTrivia(range, node, file) || isFunctionLikeDeclaration(node)) { + return "quit"; + } + + if (isIdentifier(node)) { + maybeVariableName = node; + return false; + } + + if (isVariableLike(node)) { + if (isParameterDeclaration(node) && isParameterPropertyDeclaration(node, node.parent)) { + return true; + } + return "quit"; + } + + return false; + }); + + if (!parameter && maybeVariableName && isParameter(maybeVariableName.parent) && isParameterPropertyDeclaration(maybeVariableName.parent, maybeVariableName.parent.parent)) { + parameter = maybeVariableName.parent; + } + + if (!parameter) { + return undefined; + } + + Debug.assert(isParameterPropertyDeclaration(parameter, parameter.parent)); + + const ctor = parameter.parent; + const container = ctor.parent; + + return { + parameter, + ctor, + container + }; + } + + export function getConvertParameterPropertyToPropertyChanges(changeTracker: textChanges.ChangeTracker, file: SourceFile, info: ParameterPropertyToPropertyInfo, extraModifierFlags: ModifierFlags = ModifierFlags.None) { + const { parameter, ctor, container } = info; + + const newParameter = factory.createParameterDeclaration( + parameter.decorators, + /*modifiers*/ undefined, + parameter.dotDotDotToken, + parameter.name, + parameter.questionToken, + parameter.type, + parameter.initializer + ); + changeTracker.replaceNode(file, parameter, newParameter); + + const newPropertyDeclaration = factory.createPropertyDeclaration( + /*decorators*/ undefined, + createModifiers(modifiersToFlags(parameter.modifiers) | extraModifierFlags), + factory.createIdentifier(parameter.name.text), + factory.cloneNode(parameter.questionToken), + factory.cloneNode(parameter.type), + /*initializer*/ undefined + ); + changeTracker.insertNodeAtClassStart(file, container, newPropertyDeclaration); + + const assignment = factory.createAssignment( + factory.createPropertyAccessExpression( + factory.createThis(), + factory.createIdentifier(parameter.name.text) + ), + factory.createIdentifier(parameter.name.text) + ); + changeTracker.insertNodeAtConstructorStartAfterSuperCall(file, ctor, factory.createExpressionStatement(assignment)); + } +} \ No newline at end of file diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 131cb029c6537..cf6c922462591 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -501,6 +501,16 @@ namespace ts.textChanges { } } + public insertNodeAtConstructorStartAfterSuperCall(sourceFile: SourceFile, ctr: ConstructorDeclaration, newStatement: Statement): void { + const superCallStatement = find(ctr.body!.statements, stmt => isExpressionStatement(stmt) && isSuperCall(stmt.expression)); + if (!superCallStatement || !ctr.body!.multiLine) { + this.replaceConstructorBody(sourceFile, ctr, [...ctr.body!.statements, newStatement]); + } + else { + this.insertNodeAfter(sourceFile, superCallStatement, newStatement); + } + } + public insertNodeAtConstructorEnd(sourceFile: SourceFile, ctr: ConstructorDeclaration, newStatement: Statement): void { const lastStatement = lastOrUndefined(ctr.body!.statements); if (!lastStatement || !ctr.body!.multiLine) { diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index ecaed723a0cc6..0d96321ba89c0 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -93,6 +93,7 @@ "codefixes/disableJsDiagnostics.ts", "codefixes/helpers.ts", "codefixes/generateAccessors.ts", + "codefixes/parameterPropertyToDeclaration.ts", "codefixes/fixInvalidImportSyntax.ts", "codefixes/fixStrictClassInitialization.ts", "codefixes/requireInTs.ts", From d0f50958bd45deb70fe3e6276c84f4851135b39a Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 25 Aug 2020 15:02:43 +0800 Subject: [PATCH 29/61] Add quickfix for override parameter property --- src/compiler/diagnosticMessages.json | 8 +++ src/services/codefixes/fixOverrideModifier.ts | 20 +++++- .../fourslash/codeFixOverrideModifier10.ts | 31 +++++++++ .../fourslash/codeFixOverrideModifier9.ts | 29 +++++++++ .../codeFixOverrideModifier_fixAll3.ts | 64 +++++++++++++++++++ 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/codeFixOverrideModifier10.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier9.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index cd14012276312..8cb6a05ed512f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5916,6 +5916,14 @@ "category": "Message", "code": 95147 }, + "Convert to property declaration and add 'override' modifier": { + "category": "Message", + "code": 95148 + }, + "Convert all to property declaration and add 'override' modifier": { + "category": "Message", + "code": 95149 + }, "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { "category": "Error", diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index 55d12c0bb3e70..233d7df6fd54a 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -3,11 +3,13 @@ namespace ts.codefix { const fixName = "fixOverrideModifier"; const fixAddOverrideId = "fixAddOverrideModifier"; const fixRemoveOverrideId = "fixRemoveOverrideModifier"; + const fixConvertToPropertyDeclarationId = "fixConvertToPropertyDeclaration"; const errorCodes = [ Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code, Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code, + Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0.code ]; const errorCodeFixIdMap: Record = { @@ -19,6 +21,11 @@ namespace ts.codefix { ], [Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]: [ Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier + ], + [Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0.code]: [ + Diagnostics.Convert_to_property_declaration_and_add_override_modifier, + fixConvertToPropertyDeclarationId, + Diagnostics.Convert_all_to_property_declaration_and_add_override_modifier ] }; @@ -37,7 +44,7 @@ namespace ts.codefix { createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId, fixAllDescriptions) ]; }, - fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId], + fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId, fixConvertToPropertyDeclarationId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { const { code, start } = diag; @@ -61,6 +68,8 @@ namespace ts.codefix { case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code: case Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code: return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos); + case Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0.code: + return doConvertToPropertyDeclaration(changeTracker, context.sourceFile, pos); default: Debug.fail("Unexpected error code: " + errorCode); } @@ -79,6 +88,15 @@ namespace ts.codefix { changeTracker.deleteModifier(sourceFile, overrideModifier); } + function doConvertToPropertyDeclaration(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) { + const info = getConvertParameterPropertyToPropertyInfo(sourceFile, pos); + if (!info) { + return; + } + + getConvertParameterPropertyToPropertyChanges(changeTracker, sourceFile, info, ModifierFlags.Override); + } + function findContainerClassElement(sourceFile: SourceFile, pos: number) { const token = getTokenAtPosition(sourceFile, pos); const classElement = findAncestor(token, isClassElement); diff --git a/tests/cases/fourslash/codeFixOverrideModifier10.ts b/tests/cases/fourslash/codeFixOverrideModifier10.ts new file mode 100644 index 0000000000000..955f0a5e73e5e --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier10.ts @@ -0,0 +1,31 @@ +/// + +// @pedanticOverride: true + +//// class B { +//// b: string +//// } +//// class D extends B { +//// c = 10; +//// constructor(public a: string, public readonly b: string) { +//// super(); +//// } +//// } + +verify.codeFix({ + description: "Convert to property declaration and add 'override' modifier", + index: 0, + newFileContent: +`class B { + b: string +} +class D extends B { + public readonly override b: string; + c = 10; + constructor(public a: string, b: string) { + super(); + this.b = b; + } +}`, +}) + diff --git a/tests/cases/fourslash/codeFixOverrideModifier9.ts b/tests/cases/fourslash/codeFixOverrideModifier9.ts new file mode 100644 index 0000000000000..b13495b3b188b --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier9.ts @@ -0,0 +1,29 @@ +/// + +// @pedanticOverride: true + +//// class B { +//// a: string +//// } +//// class D extends B { +//// constructor(public a: string, public b: string) { +//// super(); +//// } +//// } + +verify.codeFix({ + description: "Convert to property declaration and add 'override' modifier", + index: 0, + newFileContent: +`class B { + a: string +} +class D extends B { + public override a: string; + constructor(a: string, public b: string) { + super(); + this.a = a; + } +}`, +}) + diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts new file mode 100644 index 0000000000000..47b78312d2963 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts @@ -0,0 +1,64 @@ +/// + +// @pedanticOverride: true +//// class B { +//// a: string +//// b: string +//// } +//// class D extends B { +//// constructor(public a: string, public readonly b: string) { +//// super(); +//// } +//// } +//// class BB { +//// constructor(public a: string) { +//// } +//// } +//// class DD extends BB { +//// constructor(public a: string) { +//// super(a) +//// } +//// } +//// class DDD extends BB { +//// public a: string; +//// constructor(a: string) { +//// super(a) +//// this.a = a +//// } +//// } + +verify.codeFixAll({ + fixId: "fixConvertToPropertyDeclaration", + fixAllDescription: "Convert all to property declaration and add 'override' modifier", + newFileContent: `class B { + a: string + b: string +} +class D extends B { + public override a: string; + public readonly override b: string; + constructor(a: string, b: string) { + super(); + this.a = a; + this.b = b; + } +} +class BB { + constructor(public a: string) { + } +} +class DD extends BB { + public override a: string; + constructor(a: string) { + super(a); + this.a = a; + } +} +class DDD extends BB { + public a: string; + constructor(a: string) { + super(a) + this.a = a + } +}` +}) From 22bb09d5a1a2e28e148424129cac183162e341fe Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 3 Sep 2020 13:17:17 +0800 Subject: [PATCH 30/61] fix code style --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9e1d6a58c26f9..25909e59e3300 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -38001,10 +38001,10 @@ namespace ts { if (flags & ModifierFlags.Override) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override"); } - else if(flags & ModifierFlags.Ambient) { + else if (flags & ModifierFlags.Ambient) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "override", "declare"); } - else if(flags & ModifierFlags.Static) { + else if (flags & ModifierFlags.Static) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "override"); } flags |= ModifierFlags.Override; From eee3b77b63f73628a6aeddba0d8971894904229c Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 3 Sep 2020 13:23:06 +0800 Subject: [PATCH 31/61] Add override with interface tests --- .../baselines/reference/override9.errors.txt | 21 ++++++++++++++ tests/baselines/reference/override9.js | 28 +++++++++++++++++++ tests/baselines/reference/override9.symbols | 28 +++++++++++++++++++ tests/baselines/reference/override9.types | 23 +++++++++++++++ tests/cases/conformance/override/override9.ts | 13 +++++++++ 5 files changed, 113 insertions(+) create mode 100644 tests/baselines/reference/override9.errors.txt create mode 100644 tests/baselines/reference/override9.js create mode 100644 tests/baselines/reference/override9.symbols create mode 100644 tests/baselines/reference/override9.types create mode 100644 tests/cases/conformance/override/override9.ts diff --git a/tests/baselines/reference/override9.errors.txt b/tests/baselines/reference/override9.errors.txt new file mode 100644 index 0000000000000..a1637ec567985 --- /dev/null +++ b/tests/baselines/reference/override9.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/override/override9.ts(8,5): error TS1070: 'override' modifier cannot appear on a type member. +tests/cases/conformance/override/override9.ts(10,5): error TS1070: 'override' modifier cannot appear on a type member. + + +==== tests/cases/conformance/override/override9.ts (2 errors) ==== + interface B { + foo (): void + bar (): void + } + + interface D extends B { + foo (): void; + override bar(): void; + ~~~~~~~~ +!!! error TS1070: 'override' modifier cannot appear on a type member. + baz(): void; + override bazz(): void; + ~~~~~~~~ +!!! error TS1070: 'override' modifier cannot appear on a type member. + } + \ No newline at end of file diff --git a/tests/baselines/reference/override9.js b/tests/baselines/reference/override9.js new file mode 100644 index 0000000000000..8f109906f6bf9 --- /dev/null +++ b/tests/baselines/reference/override9.js @@ -0,0 +1,28 @@ +//// [override9.ts] +interface B { + foo (): void + bar (): void +} + +interface D extends B { + foo (): void; + override bar(): void; + baz(): void; + override bazz(): void; +} + + +//// [override9.js] + + +//// [override9.d.ts] +interface B { + foo(): void; + bar(): void; +} +interface D extends B { + foo(): void; + override bar(): void; + baz(): void; + override bazz(): void; +} diff --git a/tests/baselines/reference/override9.symbols b/tests/baselines/reference/override9.symbols new file mode 100644 index 0000000000000..e13c60a9e3801 --- /dev/null +++ b/tests/baselines/reference/override9.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/override/override9.ts === +interface B { +>B : Symbol(B, Decl(override9.ts, 0, 0)) + + foo (): void +>foo : Symbol(B.foo, Decl(override9.ts, 0, 13)) + + bar (): void +>bar : Symbol(B.bar, Decl(override9.ts, 1, 16)) +} + +interface D extends B { +>D : Symbol(D, Decl(override9.ts, 3, 1)) +>B : Symbol(B, Decl(override9.ts, 0, 0)) + + foo (): void; +>foo : Symbol(D.foo, Decl(override9.ts, 5, 23)) + + override bar(): void; +>bar : Symbol(D.bar, Decl(override9.ts, 6, 17)) + + baz(): void; +>baz : Symbol(D.baz, Decl(override9.ts, 7, 25)) + + override bazz(): void; +>bazz : Symbol(D.bazz, Decl(override9.ts, 8, 16)) +} + diff --git a/tests/baselines/reference/override9.types b/tests/baselines/reference/override9.types new file mode 100644 index 0000000000000..a7af4f6332a98 --- /dev/null +++ b/tests/baselines/reference/override9.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/override/override9.ts === +interface B { + foo (): void +>foo : () => void + + bar (): void +>bar : () => void +} + +interface D extends B { + foo (): void; +>foo : () => void + + override bar(): void; +>bar : () => void + + baz(): void; +>baz : () => void + + override bazz(): void; +>bazz : () => void +} + diff --git a/tests/cases/conformance/override/override9.ts b/tests/cases/conformance/override/override9.ts new file mode 100644 index 0000000000000..72611a78e91f7 --- /dev/null +++ b/tests/cases/conformance/override/override9.ts @@ -0,0 +1,13 @@ +// @declaration: true +// @pedanticOverride: true +interface B { + foo (): void + bar (): void +} + +interface D extends B { + foo (): void; + override bar(): void; + baz(): void; + override bazz(): void; +} From f94e93ce76f9f07bfd9a24bb38c893760112aadb Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 3 Sep 2020 13:47:04 +0800 Subject: [PATCH 32/61] Add more cases about modifier position --- .../baselines/reference/override5.errors.txt | 53 ++++++++++-- tests/baselines/reference/override5.js | 83 ++++++++++++++++++- tests/baselines/reference/override5.symbols | 80 +++++++++++++++--- tests/baselines/reference/override5.types | 62 +++++++++++++- .../baselines/reference/override7.errors.txt | 35 +++++++- tests/baselines/reference/override7.js | 83 ++++++++++++++++++- tests/baselines/reference/override7.symbols | 74 +++++++++++++++-- tests/baselines/reference/override7.types | 62 +++++++++++++- tests/cases/conformance/override/override5.ts | 33 +++++++- tests/cases/conformance/override/override7.ts | 33 +++++++- 10 files changed, 563 insertions(+), 35 deletions(-) diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt index d2c7e4e34761a..cebb92ef1eccd 100644 --- a/tests/baselines/reference/override5.errors.txt +++ b/tests/baselines/reference/override5.errors.txt @@ -1,15 +1,19 @@ -tests/cases/conformance/override/override5.ts(10,13): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override5.ts(12,14): error TS1040: 'override' modifier cannot be used in an ambient context. -tests/cases/conformance/override/override5.ts(14,14): error TS1243: 'static' modifier cannot be used with 'override' modifier. -tests/cases/conformance/override/override5.ts(16,14): error TS1030: 'override' modifier already seen. -tests/cases/conformance/override/override5.ts(19,14): error TS1029: 'public' modifier must precede 'override' modifier. -tests/cases/conformance/override/override5.ts(21,5): error TS1089: 'override' modifier cannot appear on a constructor declaration. +tests/cases/conformance/override/override5.ts(12,13): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override5.ts(14,14): error TS1040: 'override' modifier cannot be used in an ambient context. +tests/cases/conformance/override/override5.ts(20,14): error TS1243: 'static' modifier cannot be used with 'override' modifier. +tests/cases/conformance/override/override5.ts(22,14): error TS1030: 'override' modifier already seen. +tests/cases/conformance/override/override5.ts(25,14): error TS1029: 'public' modifier must precede 'override' modifier. +tests/cases/conformance/override/override5.ts(27,5): error TS1089: 'override' modifier cannot appear on a constructor declaration. +tests/cases/conformance/override/override5.ts(44,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +tests/cases/conformance/override/override5.ts(45,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. -==== tests/cases/conformance/override/override5.ts (6 errors) ==== +==== tests/cases/conformance/override/override5.ts (8 errors) ==== class B { p1: number = 1; p2: number = 2; + p3: number = 3; + p4: number = 4; oop: number; pp: number; op: number; @@ -20,10 +24,14 @@ tests/cases/conformance/override/override5.ts(21,5): error TS1089: 'override' mo ~~ !!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. - override declare p2: number + override declare p2: number; ~~~~~~~ !!! error TS1040: 'override' modifier cannot be used in an ambient context. + readonly override p3: number; + + override readonly p4: number; + override static sp: number; ~~~~~~ !!! error TS1243: 'static' modifier cannot be used with 'override' modifier. @@ -43,4 +51,33 @@ tests/cases/conformance/override/override5.ts(21,5): error TS1089: 'override' mo super(); } } + + + abstract class AB { + abstract f (): void; + abstract b (): void; + } + + abstract class AD extends AB { + override abstract f(): void; + abstract override b(): void; + } + + abstract class AND { + override abstract f(): void; + ~ +!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. + abstract override b(): void; + ~ +!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. + } + + class ADD extends AD { + override f(): void { + + } + override b(): void { + + } + } \ No newline at end of file diff --git a/tests/baselines/reference/override5.js b/tests/baselines/reference/override5.js index 2da9b88a3c773..567a0c6c6c176 100644 --- a/tests/baselines/reference/override5.js +++ b/tests/baselines/reference/override5.js @@ -2,6 +2,8 @@ class B { p1: number = 1; p2: number = 2; + p3: number = 3; + p4: number = 4; oop: number; pp: number; op: number; @@ -10,7 +12,11 @@ class B { class D extends B{ declare p1: number - override declare p2: number + override declare p2: number; + + readonly override p3: number; + + override readonly p4: number; override static sp: number; @@ -23,6 +29,31 @@ class D extends B{ super(); } } + + +abstract class AB { + abstract f (): void; + abstract b (): void; +} + +abstract class AD extends AB { + override abstract f(): void; + abstract override b(): void; +} + +abstract class AND { + override abstract f(): void; + abstract override b(): void; +} + +class ADD extends AD { + override f(): void { + + } + override b(): void { + + } +} //// [override5.js] @@ -43,6 +74,8 @@ var B = /** @class */ (function () { function B() { this.p1 = 1; this.p2 = 2; + this.p3 = 3; + this.p4 = 4; } return B; }()); @@ -53,12 +86,42 @@ var D = /** @class */ (function (_super) { } return D; }(B)); +var AB = /** @class */ (function () { + function AB() { + } + return AB; +}()); +var AD = /** @class */ (function (_super) { + __extends(AD, _super); + function AD() { + return _super !== null && _super.apply(this, arguments) || this; + } + return AD; +}(AB)); +var AND = /** @class */ (function () { + function AND() { + } + return AND; +}()); +var ADD = /** @class */ (function (_super) { + __extends(ADD, _super); + function ADD() { + return _super !== null && _super.apply(this, arguments) || this; + } + ADD.prototype.f = function () { + }; + ADD.prototype.b = function () { + }; + return ADD; +}(AD)); //// [override5.d.ts] declare class B { p1: number; p2: number; + p3: number; + p4: number; oop: number; pp: number; op: number; @@ -66,9 +129,27 @@ declare class B { declare class D extends B { p1: number; override p2: number; + readonly override p3: number; + override readonly p4: number; override static sp: number; override override oop: number; override pp: number; override op: number; override constructor(); } +declare abstract class AB { + abstract f(): void; + abstract b(): void; +} +declare abstract class AD extends AB { + override abstract f(): void; + abstract override b(): void; +} +declare abstract class AND { + override abstract f(): void; + abstract override b(): void; +} +declare class ADD extends AD { + override f(): void; + override b(): void; +} diff --git a/tests/baselines/reference/override5.symbols b/tests/baselines/reference/override5.symbols index f2aabff9e30cf..f1d0dc943b78f 100644 --- a/tests/baselines/reference/override5.symbols +++ b/tests/baselines/reference/override5.symbols @@ -8,37 +8,49 @@ class B { p2: number = 2; >p2 : Symbol(B.p2, Decl(override5.ts, 1, 19)) + p3: number = 3; +>p3 : Symbol(B.p3, Decl(override5.ts, 2, 19)) + + p4: number = 4; +>p4 : Symbol(B.p4, Decl(override5.ts, 3, 19)) + oop: number; ->oop : Symbol(B.oop, Decl(override5.ts, 2, 19)) +>oop : Symbol(B.oop, Decl(override5.ts, 4, 19)) pp: number; ->pp : Symbol(B.pp, Decl(override5.ts, 3, 16)) +>pp : Symbol(B.pp, Decl(override5.ts, 5, 16)) op: number; ->op : Symbol(B.op, Decl(override5.ts, 4, 15)) +>op : Symbol(B.op, Decl(override5.ts, 6, 15)) } class D extends B{ ->D : Symbol(D, Decl(override5.ts, 6, 1)) +>D : Symbol(D, Decl(override5.ts, 8, 1)) >B : Symbol(B, Decl(override5.ts, 0, 0)) declare p1: number ->p1 : Symbol(D.p1, Decl(override5.ts, 8, 18)) +>p1 : Symbol(D.p1, Decl(override5.ts, 10, 18)) + + override declare p2: number; +>p2 : Symbol(D.p2, Decl(override5.ts, 11, 22)) - override declare p2: number ->p2 : Symbol(D.p2, Decl(override5.ts, 9, 22)) + readonly override p3: number; +>p3 : Symbol(D.p3, Decl(override5.ts, 13, 32)) + + override readonly p4: number; +>p4 : Symbol(D.p4, Decl(override5.ts, 15, 33)) override static sp: number; ->sp : Symbol(D.sp, Decl(override5.ts, 11, 31)) +>sp : Symbol(D.sp, Decl(override5.ts, 17, 33)) override override oop: number; ->oop : Symbol(D.oop, Decl(override5.ts, 13, 31)) +>oop : Symbol(D.oop, Decl(override5.ts, 19, 31)) public override pp: number; ->pp : Symbol(D.pp, Decl(override5.ts, 15, 34)) +>pp : Symbol(D.pp, Decl(override5.ts, 21, 34)) override public op: number; ->op : Symbol(D.op, Decl(override5.ts, 17, 31)) +>op : Symbol(D.op, Decl(override5.ts, 23, 31)) override constructor () { super(); @@ -46,3 +58,49 @@ class D extends B{ } } + +abstract class AB { +>AB : Symbol(AB, Decl(override5.ts, 29, 1)) + + abstract f (): void; +>f : Symbol(AB.f, Decl(override5.ts, 32, 19)) + + abstract b (): void; +>b : Symbol(AB.b, Decl(override5.ts, 33, 24)) +} + +abstract class AD extends AB { +>AD : Symbol(AD, Decl(override5.ts, 35, 1)) +>AB : Symbol(AB, Decl(override5.ts, 29, 1)) + + override abstract f(): void; +>f : Symbol(AD.f, Decl(override5.ts, 37, 30)) + + abstract override b(): void; +>b : Symbol(AD.b, Decl(override5.ts, 38, 32)) +} + +abstract class AND { +>AND : Symbol(AND, Decl(override5.ts, 40, 1)) + + override abstract f(): void; +>f : Symbol(AND.f, Decl(override5.ts, 42, 20)) + + abstract override b(): void; +>b : Symbol(AND.b, Decl(override5.ts, 43, 32)) +} + +class ADD extends AD { +>ADD : Symbol(ADD, Decl(override5.ts, 45, 1)) +>AD : Symbol(AD, Decl(override5.ts, 35, 1)) + + override f(): void { +>f : Symbol(ADD.f, Decl(override5.ts, 47, 22)) + + } + override b(): void { +>b : Symbol(ADD.b, Decl(override5.ts, 50, 5)) + + } +} + diff --git a/tests/baselines/reference/override5.types b/tests/baselines/reference/override5.types index 56235de97d3a7..9e59e563fd650 100644 --- a/tests/baselines/reference/override5.types +++ b/tests/baselines/reference/override5.types @@ -10,6 +10,14 @@ class B { >p2 : number >2 : 2 + p3: number = 3; +>p3 : number +>3 : 3 + + p4: number = 4; +>p4 : number +>4 : 4 + oop: number; >oop : number @@ -27,9 +35,15 @@ class D extends B{ declare p1: number >p1 : number - override declare p2: number + override declare p2: number; >p2 : number + readonly override p3: number; +>p3 : number + + override readonly p4: number; +>p4 : number + override static sp: number; >sp : number @@ -49,3 +63,49 @@ class D extends B{ } } + +abstract class AB { +>AB : AB + + abstract f (): void; +>f : () => void + + abstract b (): void; +>b : () => void +} + +abstract class AD extends AB { +>AD : AD +>AB : AB + + override abstract f(): void; +>f : () => void + + abstract override b(): void; +>b : () => void +} + +abstract class AND { +>AND : AND + + override abstract f(): void; +>f : () => void + + abstract override b(): void; +>b : () => void +} + +class ADD extends AD { +>ADD : ADD +>AD : AD + + override f(): void { +>f : () => void + + } + override b(): void { +>b : () => void + + } +} + diff --git a/tests/baselines/reference/override7.errors.txt b/tests/baselines/reference/override7.errors.txt index b2fef4b63b511..0d36b747c8e18 100644 --- a/tests/baselines/reference/override7.errors.txt +++ b/tests/baselines/reference/override7.errors.txt @@ -1,16 +1,22 @@ -tests/cases/conformance/override/override7.ts(13,14): error TS1030: 'override' modifier already seen. +tests/cases/conformance/override/override7.ts(19,14): error TS1030: 'override' modifier already seen. ==== tests/cases/conformance/override/override7.ts (1 errors) ==== class B { p1: number = 1; p2: number = 2; + p3: number = 3; + p4: number = 4; } class D extends B{ declare p1: number - override declare p2: number + override declare p2: number; + + readonly override p3: number; + + override readonly p4: number; override static sp: number; @@ -25,4 +31,29 @@ tests/cases/conformance/override/override7.ts(13,14): error TS1030: 'override' m super(); } } + + + abstract class AB { + abstract f (): void; + abstract b (): void; + } + + abstract class AD extends AB { + override abstract f(): void; + abstract override b(): void; + } + + abstract class AND { + override abstract f(): void; + abstract override b(): void; + } + + class ADD extends AD { + override f(): void { + + } + override b(): void { + + } + } \ No newline at end of file diff --git a/tests/baselines/reference/override7.js b/tests/baselines/reference/override7.js index 71564dafc0f11..43184eff156a1 100644 --- a/tests/baselines/reference/override7.js +++ b/tests/baselines/reference/override7.js @@ -2,12 +2,18 @@ class B { p1: number = 1; p2: number = 2; + p3: number = 3; + p4: number = 4; } class D extends B{ declare p1: number - override declare p2: number + override declare p2: number; + + readonly override p3: number; + + override readonly p4: number; override static sp: number; @@ -20,6 +26,31 @@ class D extends B{ super(); } } + + +abstract class AB { + abstract f (): void; + abstract b (): void; +} + +abstract class AD extends AB { + override abstract f(): void; + abstract override b(): void; +} + +abstract class AND { + override abstract f(): void; + abstract override b(): void; +} + +class ADD extends AD { + override f(): void { + + } + override b(): void { + + } +} //// [override7.js] @@ -40,6 +71,8 @@ var B = /** @class */ (function () { function B() { this.p1 = 1; this.p2 = 2; + this.p3 = 3; + this.p4 = 4; } return B; }()); @@ -50,19 +83,67 @@ var D = /** @class */ (function (_super) { } return D; }(B)); +var AB = /** @class */ (function () { + function AB() { + } + return AB; +}()); +var AD = /** @class */ (function (_super) { + __extends(AD, _super); + function AD() { + return _super !== null && _super.apply(this, arguments) || this; + } + return AD; +}(AB)); +var AND = /** @class */ (function () { + function AND() { + } + return AND; +}()); +var ADD = /** @class */ (function (_super) { + __extends(ADD, _super); + function ADD() { + return _super !== null && _super.apply(this, arguments) || this; + } + ADD.prototype.f = function () { + }; + ADD.prototype.b = function () { + }; + return ADD; +}(AD)); //// [override7.d.ts] declare class B { p1: number; p2: number; + p3: number; + p4: number; } declare class D extends B { p1: number; override p2: number; + readonly override p3: number; + override readonly p4: number; override static sp: number; override override oop: number; override pp: number; override op: number; override constructor(); } +declare abstract class AB { + abstract f(): void; + abstract b(): void; +} +declare abstract class AD extends AB { + override abstract f(): void; + abstract override b(): void; +} +declare abstract class AND { + override abstract f(): void; + abstract override b(): void; +} +declare class ADD extends AD { + override f(): void; + override b(): void; +} diff --git a/tests/baselines/reference/override7.symbols b/tests/baselines/reference/override7.symbols index 98a4e85ff5fc9..4a0a173424462 100644 --- a/tests/baselines/reference/override7.symbols +++ b/tests/baselines/reference/override7.symbols @@ -7,29 +7,41 @@ class B { p2: number = 2; >p2 : Symbol(B.p2, Decl(override7.ts, 1, 19)) + + p3: number = 3; +>p3 : Symbol(B.p3, Decl(override7.ts, 2, 19)) + + p4: number = 4; +>p4 : Symbol(B.p4, Decl(override7.ts, 3, 19)) } class D extends B{ ->D : Symbol(D, Decl(override7.ts, 3, 1)) +>D : Symbol(D, Decl(override7.ts, 5, 1)) >B : Symbol(B, Decl(override7.ts, 0, 0)) declare p1: number ->p1 : Symbol(D.p1, Decl(override7.ts, 5, 18)) +>p1 : Symbol(D.p1, Decl(override7.ts, 7, 18)) + + override declare p2: number; +>p2 : Symbol(D.p2, Decl(override7.ts, 8, 22)) - override declare p2: number ->p2 : Symbol(D.p2, Decl(override7.ts, 6, 22)) + readonly override p3: number; +>p3 : Symbol(D.p3, Decl(override7.ts, 10, 32)) + + override readonly p4: number; +>p4 : Symbol(D.p4, Decl(override7.ts, 12, 33)) override static sp: number; ->sp : Symbol(D.sp, Decl(override7.ts, 8, 31)) +>sp : Symbol(D.sp, Decl(override7.ts, 14, 33)) override override oop: number; ->oop : Symbol(D.oop, Decl(override7.ts, 10, 31)) +>oop : Symbol(D.oop, Decl(override7.ts, 16, 31)) public override pp: number; ->pp : Symbol(D.pp, Decl(override7.ts, 12, 34)) +>pp : Symbol(D.pp, Decl(override7.ts, 18, 34)) override public op: number; ->op : Symbol(D.op, Decl(override7.ts, 14, 31)) +>op : Symbol(D.op, Decl(override7.ts, 20, 31)) override constructor () { super(); @@ -37,3 +49,49 @@ class D extends B{ } } + +abstract class AB { +>AB : Symbol(AB, Decl(override7.ts, 26, 1)) + + abstract f (): void; +>f : Symbol(AB.f, Decl(override7.ts, 29, 19)) + + abstract b (): void; +>b : Symbol(AB.b, Decl(override7.ts, 30, 24)) +} + +abstract class AD extends AB { +>AD : Symbol(AD, Decl(override7.ts, 32, 1)) +>AB : Symbol(AB, Decl(override7.ts, 26, 1)) + + override abstract f(): void; +>f : Symbol(AD.f, Decl(override7.ts, 34, 30)) + + abstract override b(): void; +>b : Symbol(AD.b, Decl(override7.ts, 35, 32)) +} + +abstract class AND { +>AND : Symbol(AND, Decl(override7.ts, 37, 1)) + + override abstract f(): void; +>f : Symbol(AND.f, Decl(override7.ts, 39, 20)) + + abstract override b(): void; +>b : Symbol(AND.b, Decl(override7.ts, 40, 32)) +} + +class ADD extends AD { +>ADD : Symbol(ADD, Decl(override7.ts, 42, 1)) +>AD : Symbol(AD, Decl(override7.ts, 32, 1)) + + override f(): void { +>f : Symbol(ADD.f, Decl(override7.ts, 44, 22)) + + } + override b(): void { +>b : Symbol(ADD.b, Decl(override7.ts, 47, 5)) + + } +} + diff --git a/tests/baselines/reference/override7.types b/tests/baselines/reference/override7.types index e7524ccc47d19..537b63572d7b0 100644 --- a/tests/baselines/reference/override7.types +++ b/tests/baselines/reference/override7.types @@ -9,6 +9,14 @@ class B { p2: number = 2; >p2 : number >2 : 2 + + p3: number = 3; +>p3 : number +>3 : 3 + + p4: number = 4; +>p4 : number +>4 : 4 } class D extends B{ @@ -18,9 +26,15 @@ class D extends B{ declare p1: number >p1 : number - override declare p2: number + override declare p2: number; >p2 : number + readonly override p3: number; +>p3 : number + + override readonly p4: number; +>p4 : number + override static sp: number; >sp : number @@ -40,3 +54,49 @@ class D extends B{ } } + +abstract class AB { +>AB : AB + + abstract f (): void; +>f : () => void + + abstract b (): void; +>b : () => void +} + +abstract class AD extends AB { +>AD : AD +>AB : AB + + override abstract f(): void; +>f : () => void + + abstract override b(): void; +>b : () => void +} + +abstract class AND { +>AND : AND + + override abstract f(): void; +>f : () => void + + abstract override b(): void; +>b : () => void +} + +class ADD extends AD { +>ADD : ADD +>AD : AD + + override f(): void { +>f : () => void + + } + override b(): void { +>b : () => void + + } +} + diff --git a/tests/cases/conformance/override/override5.ts b/tests/cases/conformance/override/override5.ts index 22418395f3543..a1ef61e8d120a 100644 --- a/tests/cases/conformance/override/override5.ts +++ b/tests/cases/conformance/override/override5.ts @@ -3,6 +3,8 @@ class B { p1: number = 1; p2: number = 2; + p3: number = 3; + p4: number = 4; oop: number; pp: number; op: number; @@ -11,7 +13,11 @@ class B { class D extends B{ declare p1: number - override declare p2: number + override declare p2: number; + + readonly override p3: number; + + override readonly p4: number; override static sp: number; @@ -24,3 +30,28 @@ class D extends B{ super(); } } + + +abstract class AB { + abstract f (): void; + abstract b (): void; +} + +abstract class AD extends AB { + override abstract f(): void; + abstract override b(): void; +} + +abstract class AND { + override abstract f(): void; + abstract override b(): void; +} + +class ADD extends AD { + override f(): void { + + } + override b(): void { + + } +} diff --git a/tests/cases/conformance/override/override7.ts b/tests/cases/conformance/override/override7.ts index d995847c1dcc3..f6901e3598e42 100644 --- a/tests/cases/conformance/override/override7.ts +++ b/tests/cases/conformance/override/override7.ts @@ -3,12 +3,18 @@ class B { p1: number = 1; p2: number = 2; + p3: number = 3; + p4: number = 4; } class D extends B{ declare p1: number - override declare p2: number + override declare p2: number; + + readonly override p3: number; + + override readonly p4: number; override static sp: number; @@ -21,3 +27,28 @@ class D extends B{ super(); } } + + +abstract class AB { + abstract f (): void; + abstract b (): void; +} + +abstract class AD extends AB { + override abstract f(): void; + abstract override b(): void; +} + +abstract class AND { + override abstract f(): void; + abstract override b(): void; +} + +class ADD extends AD { + override f(): void { + + } + override b(): void { + + } +} From e35ee1726e0244e9db125cf8de20cf5574516bfc Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 14 Sep 2020 14:33:15 +0800 Subject: [PATCH 33/61] rename flag --- src/compiler/checker.ts | 10 +++++----- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticMessages.json | 16 ++++++---------- src/compiler/types.ts | 2 +- .../baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- .../noImplicitOverride/tsconfig.json | 5 +++++ .../Default initialized TSConfig/tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../declarationDir-is-specified.js | 2 +- ...hen-outDir-and-declarationDir-is-specified.js | 2 +- .../when-outDir-is-specified.js | 2 +- .../with-outFile.js | 2 +- ...File-is-specified-with-declaration-enabled.js | 2 +- .../without-outDir-or-outFile-is-specified.js | 2 +- tests/cases/conformance/override/override1.ts | 2 +- tests/cases/conformance/override/override2.ts | 2 +- tests/cases/conformance/override/override3.ts | 2 +- tests/cases/conformance/override/override4.ts | 2 +- tests/cases/conformance/override/override5.ts | 2 +- tests/cases/conformance/override/override6.ts | 2 +- tests/cases/conformance/override/override7.ts | 2 +- tests/cases/conformance/override/override8.ts | 2 +- tests/cases/conformance/override/override9.ts | 2 +- 31 files changed, 44 insertions(+), 43 deletions(-) create mode 100644 tests/baselines/reference/showConfig/Shows tsconfig for single option/noImplicitOverride/tsconfig.json diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a171527862e6e..42b3c6ce77c49 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34911,7 +34911,7 @@ namespace ts { } } - if (compilerOptions.pedanticOverride && !nodeInAmbientContext) { + if (compilerOptions.noImplicitOverride && !nodeInAmbientContext) { checkMembersForMissingOverrideModifier(node, type, typeWithThis); } @@ -38361,7 +38361,7 @@ namespace ts { if (flags & ModifierFlags.AccessibilityModifier) { return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen); } - else if (compilerOptions.pedanticOverride && flags & ModifierFlags.Override) { + else if (compilerOptions.noImplicitOverride && flags & ModifierFlags.Override) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "override"); } else if (flags & ModifierFlags.Static) { @@ -38397,7 +38397,7 @@ namespace ts { else if (flags & ModifierFlags.Readonly) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (compilerOptions.pedanticOverride && flags & ModifierFlags.Override) { + else if (compilerOptions.noImplicitOverride && flags & ModifierFlags.Override) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "override"); } else if (flags & ModifierFlags.Async) { @@ -38467,7 +38467,7 @@ namespace ts { else if (flags & ModifierFlags.Async) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (compilerOptions.pedanticOverride && flags & ModifierFlags.Override) { + else if (compilerOptions.noImplicitOverride && flags & ModifierFlags.Override) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override"); } else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) { @@ -38543,7 +38543,7 @@ namespace ts { if (flags & ModifierFlags.Abstract) { return grammarErrorOnNode(lastStatic!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "abstract"); // TODO: GH#18217 } - if (compilerOptions.pedanticOverride && flags & ModifierFlags.Override) { + if (compilerOptions.noImplicitOverride && flags & ModifierFlags.Override) { return grammarErrorOnNode(lastOverride!, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } else if (flags & ModifierFlags.Async) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 2dd6d9bea610f..05e7b459c285d 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -633,7 +633,7 @@ namespace ts { description: Diagnostics.Include_undefined_in_index_signature_results }, { - name: "pedanticOverride", + name: "noImplicitOverride", type: "boolean", affectsSemanticDiagnostics: true, showInSimplifiedHelpView: false, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 41e2d7d087fce..15eb99bd3691b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -5943,33 +5943,29 @@ "category": "Message", "code": 95142 }, - "Enable the '--pedanticOverride' flag in your configuration file": { - "category": "Message", - "code": 95143 - }, "Add 'override' modifier": { "category": "Message", - "code": 95144 + "code": 95143 }, "Remove 'override' modifier": { "category": "Message", - "code": 95145 + "code": 95144 }, "Add all 'override' modifier": { "category": "Message", - "code": 95146 + "code": 95145 }, "Remove all 'override' modifier": { "category": "Message", - "code": 95147 + "code": 95146 }, "Convert to property declaration and add 'override' modifier": { "category": "Message", - "code": 95148 + "code": 95147 }, "Convert all to property declaration and add 'override' modifier": { "category": "Message", - "code": 95149 + "code": 95148 }, "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c80cf3be4437f..87f2659774629 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5798,7 +5798,7 @@ namespace ts { /*@internal*/ pathsBasePath?: string; /*@internal*/ plugins?: PluginImport[]; preserveConstEnums?: boolean; - pedanticOverride?: boolean; + noImplicitOverride?: boolean; preserveSymlinks?: boolean; /* @internal */ preserveWatchOutput?: boolean; project?: string; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2fd7c50872658..fb68445d3983a 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2850,7 +2850,7 @@ declare namespace ts { outFile?: string; paths?: MapLike; preserveConstEnums?: boolean; - pedanticOverride?: boolean; + noImplicitOverride?: boolean; preserveSymlinks?: boolean; project?: string; reactNamespace?: string; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 0750159b26a98..6c3d76a8ea957 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2850,7 +2850,7 @@ declare namespace ts { outFile?: string; paths?: MapLike; preserveConstEnums?: boolean; - pedanticOverride?: boolean; + noImplicitOverride?: boolean; preserveSymlinks?: boolean; project?: string; reactNamespace?: string; diff --git a/tests/baselines/reference/showConfig/Shows tsconfig for single option/noImplicitOverride/tsconfig.json b/tests/baselines/reference/showConfig/Shows tsconfig for single option/noImplicitOverride/tsconfig.json new file mode 100644 index 0000000000000..291a476f1ffb2 --- /dev/null +++ b/tests/baselines/reference/showConfig/Shows tsconfig for single option/noImplicitOverride/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "noImplicitOverride": true + } +} diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index f54cc4ffb38bd..266bbefe1886a 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index d31a17df98a56..c3314b2dd94b4 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 82d1c0c217c29..b50f31a872dbd 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 6a74875a6645b..1dda3151aeabc 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index 49d74b1b3d0e4..b01a02f78f7cb 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 7ecb0d4b93113..800aedbe2cc95 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index f54cc4ffb38bd..266bbefe1886a 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index c01a584cb6e5d..27be2196abd93 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 71c6761913ca5..b219b7d069e42 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js index 9db13593e13ca..a0d0eaed18a43 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js index 486a58450bede..a9638dd05a1c5 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js index cde4d9e15b4ee..76d5ba88bc43b 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js index 995c5ab8d7c85..fb67dfd9c6900 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js index 3ceb5c3bbf6e8..4d3a5deef7ba1 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js index a34a0ec302aa8..91df0814da689 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "pedanticOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ diff --git a/tests/cases/conformance/override/override1.ts b/tests/cases/conformance/override/override1.ts index 1c2a8e3ded07f..d83232dab6095 100644 --- a/tests/cases/conformance/override/override1.ts +++ b/tests/cases/conformance/override/override1.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: true +// @noImplicitOverride: true class B { foo (v: string) {} fooo (v: string) {} diff --git a/tests/cases/conformance/override/override2.ts b/tests/cases/conformance/override/override2.ts index 5c9a3b896b9be..8f4404842ab04 100644 --- a/tests/cases/conformance/override/override2.ts +++ b/tests/cases/conformance/override/override2.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: true +// @noImplicitOverride: true abstract class AB { abstract foo(v: string): void; diff --git a/tests/cases/conformance/override/override3.ts b/tests/cases/conformance/override/override3.ts index 7c68d65919e93..1930ced3d1198 100644 --- a/tests/cases/conformance/override/override3.ts +++ b/tests/cases/conformance/override/override3.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: true +// @noImplicitOverride: true declare class B { foo(): void bar(): void diff --git a/tests/cases/conformance/override/override4.ts b/tests/cases/conformance/override/override4.ts index be3e7ddb05e3a..441fdb73552a7 100644 --- a/tests/cases/conformance/override/override4.ts +++ b/tests/cases/conformance/override/override4.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: true +// @noImplicitOverride: true class B { p1: number = 1; p2: number = 1; diff --git a/tests/cases/conformance/override/override5.ts b/tests/cases/conformance/override/override5.ts index a1ef61e8d120a..834484f4ec90e 100644 --- a/tests/cases/conformance/override/override5.ts +++ b/tests/cases/conformance/override/override5.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: true +// @noImplicitOverride: true class B { p1: number = 1; p2: number = 2; diff --git a/tests/cases/conformance/override/override6.ts b/tests/cases/conformance/override/override6.ts index ff9c6ae2fcb8f..df9f34f51a8ff 100644 --- a/tests/cases/conformance/override/override6.ts +++ b/tests/cases/conformance/override/override6.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: true +// @noImplicitOverride: true class B { public baz: number = 1; constructor(public foo: string, public bar: number) { diff --git a/tests/cases/conformance/override/override7.ts b/tests/cases/conformance/override/override7.ts index f6901e3598e42..14881e1051a3b 100644 --- a/tests/cases/conformance/override/override7.ts +++ b/tests/cases/conformance/override/override7.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: false +// @noImplicitOverride: false class B { p1: number = 1; p2: number = 2; diff --git a/tests/cases/conformance/override/override8.ts b/tests/cases/conformance/override/override8.ts index fbeb407778725..0525a39f4215f 100644 --- a/tests/cases/conformance/override/override8.ts +++ b/tests/cases/conformance/override/override8.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: true +// @noImplicitOverride: true class B { a: string } diff --git a/tests/cases/conformance/override/override9.ts b/tests/cases/conformance/override/override9.ts index 72611a78e91f7..cac32f455ac29 100644 --- a/tests/cases/conformance/override/override9.ts +++ b/tests/cases/conformance/override/override9.ts @@ -1,5 +1,5 @@ // @declaration: true -// @pedanticOverride: true +// @noImplicitOverride: true interface B { foo (): void bar (): void From d8fda5f8f0c252ea6509933488827ee4cd037603 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 14 Sep 2020 14:46:24 +0800 Subject: [PATCH 34/61] rename flags --- tests/cases/fourslash/codeFixOverrideModifier1.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier10.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier2.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier3.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier4.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier5.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier6.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier7.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier8.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier9.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts | 2 +- tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/cases/fourslash/codeFixOverrideModifier1.ts b/tests/cases/fourslash/codeFixOverrideModifier1.ts index 688597d03524c..1930b2130a88a 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier1.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier1.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// foo (v: string) {} //// fooo (v: string) {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier10.ts b/tests/cases/fourslash/codeFixOverrideModifier10.ts index 955f0a5e73e5e..108a5d2d8cb2b 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier10.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier10.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// b: string diff --git a/tests/cases/fourslash/codeFixOverrideModifier2.ts b/tests/cases/fourslash/codeFixOverrideModifier2.ts index 04f715491ecd2..5b590f23330de 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier2.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier2.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// foo (v: string) {} //// fooo (v: string) {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier3.ts b/tests/cases/fourslash/codeFixOverrideModifier3.ts index fd67ed06caab3..40f8ed0b5afbc 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier3.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier3.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class E extends (class { //// foo () {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier4.ts b/tests/cases/fourslash/codeFixOverrideModifier4.ts index 1f541092d7f97..24a5e643cf9b2 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier4.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier4.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// foo (v: string) {} //// fooo (v: string) {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier5.ts b/tests/cases/fourslash/codeFixOverrideModifier5.ts index d516726b6b774..b81cd1ff08a0c 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier5.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier5.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class C { //// [|override foo(v: string) {}|] //// } diff --git a/tests/cases/fourslash/codeFixOverrideModifier6.ts b/tests/cases/fourslash/codeFixOverrideModifier6.ts index a160a8321a3dc..ae3e9566320ca 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier6.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier6.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// foo (v: string) {} //// fooo (v: string) {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier7.ts b/tests/cases/fourslash/codeFixOverrideModifier7.ts index 2a4e3bb0091a9..2e4fb59337344 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier7.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier7.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class E extends (class { //// foo () {} //// bar () {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier8.ts b/tests/cases/fourslash/codeFixOverrideModifier8.ts index 747f75f6e9b34..d39ee2778533d 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier8.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier8.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// function ff () { //// return class { //// [|override foo () {}|] diff --git a/tests/cases/fourslash/codeFixOverrideModifier9.ts b/tests/cases/fourslash/codeFixOverrideModifier9.ts index b13495b3b188b..de26d7e6cd700 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier9.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier9.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// a: string diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts index d4a7dd979ed07..1f21a7488acc9 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// foo (v: string) {} //// fooo (v: string) {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts index 13d75a9381dc8..a0912468b9410 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// foo (v: string) {} //// fooo (v: string) {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts index 47b78312d2963..c8090d6ca358e 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts @@ -1,6 +1,6 @@ /// -// @pedanticOverride: true +// @noImplicitOverride: true //// class B { //// a: string //// b: string From 18434fd1269a4f0aff8d5de7c45db9754aafbace Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 14 Sep 2020 16:46:26 -0700 Subject: [PATCH 35/61] Added tests. --- .../overrideWithoutNoImplicitOverride1.ts | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts diff --git a/tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts b/tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts new file mode 100644 index 0000000000000..c4c24e49c74b5 --- /dev/null +++ b/tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts @@ -0,0 +1,47 @@ +// @noImplicitOverride: false + +export declare class AmbientClass { + override yadda(): void; +} + +export class NonAmbientClass { + override yadda(): void {} +} + +///// + +export declare class AmbientBase { + foo(): void; +} + +export declare class AmbientDerived extends AmbientBase { + foo(): void; + + override bar(): void; +} + +///// + +declare namespace ambientNamespace { + export class AmbientBase { + foo(): void; + } + + export class AmbientDerived extends AmbientBase { + foo(): void; + + override bar(): void; + } +} + +///// + +export class NonAmbientBase { + foo(): void {} +} + +export class NonAmbientDerived extends NonAmbientBase { + foo(): void {} + + override bar(): void {} +} From 5ab5a7f82bbf062f06266e2eb987649e745eb43e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 14 Sep 2020 17:01:58 -0700 Subject: [PATCH 36/61] Accepted baselines. --- .../overrideWithoutNoImplicitOverride1.js | 90 +++++++++++++++++++ ...overrideWithoutNoImplicitOverride1.symbols | 79 ++++++++++++++++ .../overrideWithoutNoImplicitOverride1.types | 79 ++++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 tests/baselines/reference/overrideWithoutNoImplicitOverride1.js create mode 100644 tests/baselines/reference/overrideWithoutNoImplicitOverride1.symbols create mode 100644 tests/baselines/reference/overrideWithoutNoImplicitOverride1.types diff --git a/tests/baselines/reference/overrideWithoutNoImplicitOverride1.js b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.js new file mode 100644 index 0000000000000..ec2a880e30e6c --- /dev/null +++ b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.js @@ -0,0 +1,90 @@ +//// [overrideWithoutNoImplicitOverride1.ts] +export declare class AmbientClass { + override yadda(): void; +} + +export class NonAmbientClass { + override yadda(): void {} +} + +///// + +export declare class AmbientBase { + foo(): void; +} + +export declare class AmbientDerived extends AmbientBase { + foo(): void; + + override bar(): void; +} + +///// + +declare namespace ambientNamespace { + export class AmbientBase { + foo(): void; + } + + export class AmbientDerived extends AmbientBase { + foo(): void; + + override bar(): void; + } +} + +///// + +export class NonAmbientBase { + foo(): void {} +} + +export class NonAmbientDerived extends NonAmbientBase { + foo(): void {} + + override bar(): void {} +} + + +//// [overrideWithoutNoImplicitOverride1.js] +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +exports.NonAmbientDerived = exports.NonAmbientBase = exports.NonAmbientClass = void 0; +var NonAmbientClass = /** @class */ (function () { + function NonAmbientClass() { + } + NonAmbientClass.prototype.yadda = function () { }; + return NonAmbientClass; +}()); +exports.NonAmbientClass = NonAmbientClass; +///// +var NonAmbientBase = /** @class */ (function () { + function NonAmbientBase() { + } + NonAmbientBase.prototype.foo = function () { }; + return NonAmbientBase; +}()); +exports.NonAmbientBase = NonAmbientBase; +var NonAmbientDerived = /** @class */ (function (_super) { + __extends(NonAmbientDerived, _super); + function NonAmbientDerived() { + return _super !== null && _super.apply(this, arguments) || this; + } + NonAmbientDerived.prototype.foo = function () { }; + NonAmbientDerived.prototype.bar = function () { }; + return NonAmbientDerived; +}(NonAmbientBase)); +exports.NonAmbientDerived = NonAmbientDerived; diff --git a/tests/baselines/reference/overrideWithoutNoImplicitOverride1.symbols b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.symbols new file mode 100644 index 0000000000000..f4db5c5b1c1d1 --- /dev/null +++ b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.symbols @@ -0,0 +1,79 @@ +=== tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts === +export declare class AmbientClass { +>AmbientClass : Symbol(AmbientClass, Decl(overrideWithoutNoImplicitOverride1.ts, 0, 0)) + + override yadda(): void; +>yadda : Symbol(AmbientClass.yadda, Decl(overrideWithoutNoImplicitOverride1.ts, 0, 35)) +} + +export class NonAmbientClass { +>NonAmbientClass : Symbol(NonAmbientClass, Decl(overrideWithoutNoImplicitOverride1.ts, 2, 1)) + + override yadda(): void {} +>yadda : Symbol(NonAmbientClass.yadda, Decl(overrideWithoutNoImplicitOverride1.ts, 4, 30)) +} + +///// + +export declare class AmbientBase { +>AmbientBase : Symbol(AmbientBase, Decl(overrideWithoutNoImplicitOverride1.ts, 6, 1)) + + foo(): void; +>foo : Symbol(AmbientBase.foo, Decl(overrideWithoutNoImplicitOverride1.ts, 10, 34)) +} + +export declare class AmbientDerived extends AmbientBase { +>AmbientDerived : Symbol(AmbientDerived, Decl(overrideWithoutNoImplicitOverride1.ts, 12, 1)) +>AmbientBase : Symbol(AmbientBase, Decl(overrideWithoutNoImplicitOverride1.ts, 6, 1)) + + foo(): void; +>foo : Symbol(AmbientDerived.foo, Decl(overrideWithoutNoImplicitOverride1.ts, 14, 57)) + + override bar(): void; +>bar : Symbol(AmbientDerived.bar, Decl(overrideWithoutNoImplicitOverride1.ts, 15, 16)) +} + +///// + +declare namespace ambientNamespace { +>ambientNamespace : Symbol(ambientNamespace, Decl(overrideWithoutNoImplicitOverride1.ts, 18, 1)) + + export class AmbientBase { +>AmbientBase : Symbol(AmbientBase, Decl(overrideWithoutNoImplicitOverride1.ts, 22, 36)) + + foo(): void; +>foo : Symbol(AmbientBase.foo, Decl(overrideWithoutNoImplicitOverride1.ts, 23, 30)) + } + + export class AmbientDerived extends AmbientBase { +>AmbientDerived : Symbol(AmbientDerived, Decl(overrideWithoutNoImplicitOverride1.ts, 25, 5)) +>AmbientBase : Symbol(AmbientBase, Decl(overrideWithoutNoImplicitOverride1.ts, 22, 36)) + + foo(): void; +>foo : Symbol(AmbientDerived.foo, Decl(overrideWithoutNoImplicitOverride1.ts, 27, 53)) + + override bar(): void; +>bar : Symbol(AmbientDerived.bar, Decl(overrideWithoutNoImplicitOverride1.ts, 28, 20)) + } +} + +///// + +export class NonAmbientBase { +>NonAmbientBase : Symbol(NonAmbientBase, Decl(overrideWithoutNoImplicitOverride1.ts, 32, 1)) + + foo(): void {} +>foo : Symbol(NonAmbientBase.foo, Decl(overrideWithoutNoImplicitOverride1.ts, 36, 29)) +} + +export class NonAmbientDerived extends NonAmbientBase { +>NonAmbientDerived : Symbol(NonAmbientDerived, Decl(overrideWithoutNoImplicitOverride1.ts, 38, 1)) +>NonAmbientBase : Symbol(NonAmbientBase, Decl(overrideWithoutNoImplicitOverride1.ts, 32, 1)) + + foo(): void {} +>foo : Symbol(NonAmbientDerived.foo, Decl(overrideWithoutNoImplicitOverride1.ts, 40, 55)) + + override bar(): void {} +>bar : Symbol(NonAmbientDerived.bar, Decl(overrideWithoutNoImplicitOverride1.ts, 41, 18)) +} + diff --git a/tests/baselines/reference/overrideWithoutNoImplicitOverride1.types b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.types new file mode 100644 index 0000000000000..4451b77855192 --- /dev/null +++ b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.types @@ -0,0 +1,79 @@ +=== tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts === +export declare class AmbientClass { +>AmbientClass : AmbientClass + + override yadda(): void; +>yadda : () => void +} + +export class NonAmbientClass { +>NonAmbientClass : NonAmbientClass + + override yadda(): void {} +>yadda : () => void +} + +///// + +export declare class AmbientBase { +>AmbientBase : AmbientBase + + foo(): void; +>foo : () => void +} + +export declare class AmbientDerived extends AmbientBase { +>AmbientDerived : AmbientDerived +>AmbientBase : AmbientBase + + foo(): void; +>foo : () => void + + override bar(): void; +>bar : () => void +} + +///// + +declare namespace ambientNamespace { +>ambientNamespace : typeof ambientNamespace + + export class AmbientBase { +>AmbientBase : AmbientBase + + foo(): void; +>foo : () => void + } + + export class AmbientDerived extends AmbientBase { +>AmbientDerived : AmbientDerived +>AmbientBase : AmbientBase + + foo(): void; +>foo : () => void + + override bar(): void; +>bar : () => void + } +} + +///// + +export class NonAmbientBase { +>NonAmbientBase : NonAmbientBase + + foo(): void {} +>foo : () => void +} + +export class NonAmbientDerived extends NonAmbientBase { +>NonAmbientDerived : NonAmbientDerived +>NonAmbientBase : NonAmbientBase + + foo(): void {} +>foo : () => void + + override bar(): void {} +>bar : () => void +} + From f52822ad8582f9e0312da78fbc135940143e8b8f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 14 Sep 2020 17:14:10 -0700 Subject: [PATCH 37/61] Always issue errors for unnecessary 'override' modifiers. --- src/compiler/checker.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 42b3c6ce77c49..7a2a5f5d902b9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34911,9 +34911,7 @@ namespace ts { } } - if (compilerOptions.noImplicitOverride && !nodeInAmbientContext) { - checkMembersForMissingOverrideModifier(node, type, typeWithThis); - } + checkMembersForMissingOverrideModifier(node, type, typeWithThis); const implementedTypeNodes = getEffectiveImplementsTypeNodes(node); if (implementedTypeNodes) { @@ -34950,6 +34948,7 @@ namespace ts { } function checkMembersForMissingOverrideModifier(node: ClassLikeDeclaration, type: InterfaceType, typeWithThis: Type) { + const nodeInAmbientContext = !!(node.flags & NodeFlags.Ambient); const baseTypeNode = getEffectiveBaseTypeNode(node); const baseTypes = baseTypeNode && getBaseTypes(type); const baseWithThis = baseTypes?.length ? getTypeWithThisArgument(first(baseTypes), type.thisType) : undefined; @@ -34975,7 +34974,7 @@ namespace ts { if (prop && !baseProp && hasOverride) { error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); } - else if (prop && baseProp && !hasOverride) { + else if (prop && baseProp && !hasOverride && compilerOptions.noImplicitOverride && !nodeInAmbientContext) { const diag = memberIsParameterProperty ? Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0 : Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; From 48c23a5725e23b6914aa8669813a62907a594f09 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 14 Sep 2020 17:15:37 -0700 Subject: [PATCH 38/61] Accepted baselines. --- .../baselines/reference/override7.errors.txt | 17 ++++- ...rrideWithoutNoImplicitOverride1.errors.txt | 64 +++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/overrideWithoutNoImplicitOverride1.errors.txt diff --git a/tests/baselines/reference/override7.errors.txt b/tests/baselines/reference/override7.errors.txt index 0d36b747c8e18..949fda941ec2d 100644 --- a/tests/baselines/reference/override7.errors.txt +++ b/tests/baselines/reference/override7.errors.txt @@ -1,7 +1,12 @@ tests/cases/conformance/override/override7.ts(19,14): error TS1030: 'override' modifier already seen. +tests/cases/conformance/override/override7.ts(19,23): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override7.ts(21,21): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override7.ts(22,21): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override7.ts(41,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +tests/cases/conformance/override/override7.ts(42,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. -==== tests/cases/conformance/override/override7.ts (1 errors) ==== +==== tests/cases/conformance/override/override7.ts (6 errors) ==== class B { p1: number = 1; p2: number = 2; @@ -23,9 +28,15 @@ tests/cases/conformance/override/override7.ts(19,14): error TS1030: 'override' m override override oop: number; ~~~~~~~~ !!! error TS1030: 'override' modifier already seen. + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. public override pp: number; + ~~ +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. override public op: number; + ~~ +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. override constructor () { super(); @@ -45,7 +56,11 @@ tests/cases/conformance/override/override7.ts(19,14): error TS1030: 'override' m abstract class AND { override abstract f(): void; + ~ +!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. abstract override b(): void; + ~ +!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. } class ADD extends AD { diff --git a/tests/baselines/reference/overrideWithoutNoImplicitOverride1.errors.txt b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.errors.txt new file mode 100644 index 0000000000000..6b48fd7ca48d9 --- /dev/null +++ b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.errors.txt @@ -0,0 +1,64 @@ +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(2,14): error TS4111: This member cannot have an 'override' modifier because its containing class 'AmbientClass' does not extend another class. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(6,14): error TS4111: This member cannot have an 'override' modifier because its containing class 'NonAmbientClass' does not extend another class. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(18,14): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(31,18): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(44,14): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'NonAmbientBase'. + + +==== tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts (5 errors) ==== + export declare class AmbientClass { + override yadda(): void; + ~~~~~ +!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AmbientClass' does not extend another class. + } + + export class NonAmbientClass { + override yadda(): void {} + ~~~~~ +!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'NonAmbientClass' does not extend another class. + } + + ///// + + export declare class AmbientBase { + foo(): void; + } + + export declare class AmbientDerived extends AmbientBase { + foo(): void; + + override bar(): void; + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. + } + + ///// + + declare namespace ambientNamespace { + export class AmbientBase { + foo(): void; + } + + export class AmbientDerived extends AmbientBase { + foo(): void; + + override bar(): void; + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. + } + } + + ///// + + export class NonAmbientBase { + foo(): void {} + } + + export class NonAmbientDerived extends NonAmbientBase { + foo(): void {} + + override bar(): void {} + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'NonAmbientBase'. + } + \ No newline at end of file From cdd0739827ad24077e34ead7dcf103d5d27f5855 Mon Sep 17 00:00:00 2001 From: Wenlu Wang Date: Tue, 15 Sep 2020 17:30:48 +0800 Subject: [PATCH 39/61] Override perf (#4) * try cache check result * pre check for override --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a700fb91f215c..cf67a655edee0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34993,7 +34993,7 @@ namespace ts { } function checkClassMember(member: ClassElement | ParameterPropertyDeclaration, memberIsParameterProperty?: boolean) { const hasOverride = hasOverrideModifier(member); - if (baseWithThis) { + if (baseWithThis && (hasOverride || compilerOptions.noImplicitOverride)) { const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); if (declaredProp) { const baseClassName = typeToString(baseWithThis); From 827bc95b6ad9d2e8736c0d47ecb02d067cb3614d Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 17 Sep 2020 02:42:01 +0800 Subject: [PATCH 40/61] Do not issue error if implement abstract --- src/compiler/checker.ts | 2 +- src/compiler/utilities.ts | 4 +++ .../baselines/reference/override2.errors.txt | 32 ------------------- 3 files changed, 5 insertions(+), 33 deletions(-) delete mode 100644 tests/baselines/reference/override2.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cf67a655edee0..84c2cd072f5b1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -35002,7 +35002,7 @@ namespace ts { if (prop && !baseProp && hasOverride) { error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); } - else if (prop && baseProp && !hasOverride && compilerOptions.noImplicitOverride && !nodeInAmbientContext) { + else if (prop && baseProp && !hasOverride && compilerOptions.noImplicitOverride && !nodeInAmbientContext && !hasAbstractModifier(baseProp.valueDeclaration)) { const diag = memberIsParameterProperty ? Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0 : Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9a2c81e23dc0c..2800c3e1b0f52 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4577,6 +4577,10 @@ namespace ts { return hasSyntacticModifier(node, ModifierFlags.Override); } + export function hasAbstractModifier(node: Node): boolean { + return hasSyntacticModifier(node, ModifierFlags.Abstract); + } + export function hasAmbientModifier(node: Node): boolean { return hasSyntacticModifier(node, ModifierFlags.Ambient); } diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt deleted file mode 100644 index cdf4888455268..0000000000000 --- a/tests/baselines/reference/override2.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -tests/cases/conformance/override/override2.ts(12,14): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. -tests/cases/conformance/override/override2.ts(17,14): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. - - -==== tests/cases/conformance/override/override2.ts (2 errors) ==== - abstract class AB { - abstract foo(v: string): void; - - abstract bar(v: string): void - } - - abstract class AD1 extends AB { - - } - - abstract class AD2 extends AB { - abstract foo(v: ''): void // need override? - ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. - } - - abstract class AD3 extends AB { - override foo(v: ''): void { } // need override? - abstract bar(): void; - ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. - } - - class D4 extends AB { - override foo(v: ''): void {} - override bar(v: ''): void {} - } \ No newline at end of file From 618f88311fb91ce9263ef494095fb0916707bdf8 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 17 Sep 2020 03:02:34 +0800 Subject: [PATCH 41/61] Add abstract-spec check --- src/compiler/checker.ts | 15 ++++-- src/compiler/diagnosticMessages.json | 4 ++ .../baselines/reference/override2.errors.txt | 50 +++++++++++++++++++ tests/baselines/reference/override2.js | 10 +++- tests/baselines/reference/override2.symbols | 38 ++++++++------ tests/baselines/reference/override2.types | 12 ++++- .../baselines/reference/override5.errors.txt | 10 +++- tests/baselines/reference/override5.js | 4 +- tests/baselines/reference/override5.symbols | 2 +- tests/baselines/reference/override5.types | 2 +- tests/cases/conformance/override/override2.ts | 5 +- tests/cases/conformance/override/override5.ts | 2 +- 12 files changed, 125 insertions(+), 29 deletions(-) create mode 100644 tests/baselines/reference/override2.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 84c2cd072f5b1..20a2247911428 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -35002,11 +35002,16 @@ namespace ts { if (prop && !baseProp && hasOverride) { error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); } - else if (prop && baseProp && !hasOverride && compilerOptions.noImplicitOverride && !nodeInAmbientContext && !hasAbstractModifier(baseProp.valueDeclaration)) { - const diag = memberIsParameterProperty ? - Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0 : - Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; - error(member, diag, baseClassName); + else if (prop && baseProp && compilerOptions.noImplicitOverride && !nodeInAmbientContext) { + if (!hasOverride) { + const diag = memberIsParameterProperty ? + Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0 : + Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; + error(member, diag, baseClassName); + } + else if (!hasAbstractModifier(member) && hasAbstractModifier(baseProp.valueDeclaration)) { + error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0, baseClassName); + } } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 37ff2e5261bde..83e017e561352 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3428,6 +3428,10 @@ "category": "Error", "code": 4114 }, + "This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class '{0}'.": { + "category": "Error", + "code": 4115 + }, "The current host does not support the '{0}' option.": { "category": "Error", diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt new file mode 100644 index 0000000000000..97709715ff4ea --- /dev/null +++ b/tests/baselines/reference/override2.errors.txt @@ -0,0 +1,50 @@ +tests/cases/conformance/override/override2.ts(13,14): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. +tests/cases/conformance/override/override2.ts(17,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(18,14): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. +tests/cases/conformance/override/override2.ts(19,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. +tests/cases/conformance/override/override2.ts(23,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(24,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(25,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. + + +==== tests/cases/conformance/override/override2.ts (7 errors) ==== + abstract class AB { + abstract foo(v: string): void; + + abstract bar(v: string): void; + abstract baz(v: string): void; + } + + abstract class AD1 extends AB { + + } + + abstract class AD2 extends AB { + abstract foo(v: ''): void // need override? + ~~~ +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. + } + + abstract class AD3 extends AB { + override foo(v: ''): void { } // need override? + ~~~ +!!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. + abstract bar(): void; + ~~~ +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. + baz(): void { } + ~~~ +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. + } + + class D4 extends AB { + override foo(v: ''): void {} + ~~~ +!!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. + override bar(v: ''): void {} + ~~~ +!!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. + baz(): void { } + ~~~ +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. + } \ No newline at end of file diff --git a/tests/baselines/reference/override2.js b/tests/baselines/reference/override2.js index caf452683168b..a2940f3ed7be9 100644 --- a/tests/baselines/reference/override2.js +++ b/tests/baselines/reference/override2.js @@ -2,7 +2,8 @@ abstract class AB { abstract foo(v: string): void; - abstract bar(v: string): void + abstract bar(v: string): void; + abstract baz(v: string): void; } abstract class AD1 extends AB { @@ -16,11 +17,13 @@ abstract class AD2 extends AB { abstract class AD3 extends AB { override foo(v: ''): void { } // need override? abstract bar(): void; + baz(): void { } } class D4 extends AB { override foo(v: ''): void {} override bar(v: ''): void {} + baz(): void { } } //// [override2.js] @@ -62,6 +65,7 @@ var AD3 = /** @class */ (function (_super) { return _super !== null && _super.apply(this, arguments) || this; } AD3.prototype.foo = function (v) { }; // need override? + AD3.prototype.baz = function () { }; return AD3; }(AB)); var D4 = /** @class */ (function (_super) { @@ -71,6 +75,7 @@ var D4 = /** @class */ (function (_super) { } D4.prototype.foo = function (v) { }; D4.prototype.bar = function (v) { }; + D4.prototype.baz = function () { }; return D4; }(AB)); @@ -79,6 +84,7 @@ var D4 = /** @class */ (function (_super) { declare abstract class AB { abstract foo(v: string): void; abstract bar(v: string): void; + abstract baz(v: string): void; } declare abstract class AD1 extends AB { } @@ -88,8 +94,10 @@ declare abstract class AD2 extends AB { declare abstract class AD3 extends AB { override foo(v: ''): void; abstract bar(): void; + baz(): void; } declare class D4 extends AB { override foo(v: ''): void; override bar(v: ''): void; + baz(): void; } diff --git a/tests/baselines/reference/override2.symbols b/tests/baselines/reference/override2.symbols index 4b12174e133f5..869047851e5e3 100644 --- a/tests/baselines/reference/override2.symbols +++ b/tests/baselines/reference/override2.symbols @@ -6,47 +6,57 @@ abstract class AB { >foo : Symbol(AB.foo, Decl(override2.ts, 0, 19)) >v : Symbol(v, Decl(override2.ts, 1, 17)) - abstract bar(v: string): void + abstract bar(v: string): void; >bar : Symbol(AB.bar, Decl(override2.ts, 1, 34)) >v : Symbol(v, Decl(override2.ts, 3, 17)) + + abstract baz(v: string): void; +>baz : Symbol(AB.baz, Decl(override2.ts, 3, 34)) +>v : Symbol(v, Decl(override2.ts, 4, 17)) } abstract class AD1 extends AB { ->AD1 : Symbol(AD1, Decl(override2.ts, 4, 1)) +>AD1 : Symbol(AD1, Decl(override2.ts, 5, 1)) >AB : Symbol(AB, Decl(override2.ts, 0, 0)) } abstract class AD2 extends AB { ->AD2 : Symbol(AD2, Decl(override2.ts, 8, 1)) +>AD2 : Symbol(AD2, Decl(override2.ts, 9, 1)) >AB : Symbol(AB, Decl(override2.ts, 0, 0)) abstract foo(v: ''): void // need override? ->foo : Symbol(AD2.foo, Decl(override2.ts, 10, 31)) ->v : Symbol(v, Decl(override2.ts, 11, 17)) +>foo : Symbol(AD2.foo, Decl(override2.ts, 11, 31)) +>v : Symbol(v, Decl(override2.ts, 12, 17)) } abstract class AD3 extends AB { ->AD3 : Symbol(AD3, Decl(override2.ts, 12, 1)) +>AD3 : Symbol(AD3, Decl(override2.ts, 13, 1)) >AB : Symbol(AB, Decl(override2.ts, 0, 0)) override foo(v: ''): void { } // need override? ->foo : Symbol(AD3.foo, Decl(override2.ts, 14, 31)) ->v : Symbol(v, Decl(override2.ts, 15, 17)) +>foo : Symbol(AD3.foo, Decl(override2.ts, 15, 31)) +>v : Symbol(v, Decl(override2.ts, 16, 17)) abstract bar(): void; ->bar : Symbol(AD3.bar, Decl(override2.ts, 15, 33)) +>bar : Symbol(AD3.bar, Decl(override2.ts, 16, 33)) + + baz(): void { } +>baz : Symbol(AD3.baz, Decl(override2.ts, 17, 25)) } class D4 extends AB { ->D4 : Symbol(D4, Decl(override2.ts, 17, 1)) +>D4 : Symbol(D4, Decl(override2.ts, 19, 1)) >AB : Symbol(AB, Decl(override2.ts, 0, 0)) override foo(v: ''): void {} ->foo : Symbol(D4.foo, Decl(override2.ts, 19, 21)) ->v : Symbol(v, Decl(override2.ts, 20, 17)) +>foo : Symbol(D4.foo, Decl(override2.ts, 21, 21)) +>v : Symbol(v, Decl(override2.ts, 22, 17)) override bar(v: ''): void {} ->bar : Symbol(D4.bar, Decl(override2.ts, 20, 32)) ->v : Symbol(v, Decl(override2.ts, 21, 17)) +>bar : Symbol(D4.bar, Decl(override2.ts, 22, 32)) +>v : Symbol(v, Decl(override2.ts, 23, 17)) + + baz(): void { } +>baz : Symbol(D4.baz, Decl(override2.ts, 23, 32)) } diff --git a/tests/baselines/reference/override2.types b/tests/baselines/reference/override2.types index 86acdd10c3dca..98bd1f1902a73 100644 --- a/tests/baselines/reference/override2.types +++ b/tests/baselines/reference/override2.types @@ -6,8 +6,12 @@ abstract class AB { >foo : (v: string) => void >v : string - abstract bar(v: string): void + abstract bar(v: string): void; >bar : (v: string) => void +>v : string + + abstract baz(v: string): void; +>baz : (v: string) => void >v : string } @@ -36,6 +40,9 @@ abstract class AD3 extends AB { abstract bar(): void; >bar : () => void + + baz(): void { } +>baz : () => void } class D4 extends AB { @@ -49,4 +56,7 @@ class D4 extends AB { override bar(v: ''): void {} >bar : (v: '') => void >v : "" + + baz(): void { } +>baz : () => void } diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt index cebb92ef1eccd..d2cdc3d46b73a 100644 --- a/tests/baselines/reference/override5.errors.txt +++ b/tests/baselines/reference/override5.errors.txt @@ -6,9 +6,11 @@ tests/cases/conformance/override/override5.ts(25,14): error TS1029: 'public' mod tests/cases/conformance/override/override5.ts(27,5): error TS1089: 'override' modifier cannot appear on a constructor declaration. tests/cases/conformance/override/override5.ts(44,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. tests/cases/conformance/override/override5.ts(45,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +tests/cases/conformance/override/override5.ts(49,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AD'. +tests/cases/conformance/override/override5.ts(52,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. -==== tests/cases/conformance/override/override5.ts (8 errors) ==== +==== tests/cases/conformance/override/override5.ts (10 errors) ==== class B { p1: number = 1; p2: number = 2; @@ -73,10 +75,14 @@ tests/cases/conformance/override/override5.ts(45,23): error TS4111: This member } class ADD extends AD { - override f(): void { + f(): void { + ~ +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AD'. } override b(): void { + ~ +!!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. } } diff --git a/tests/baselines/reference/override5.js b/tests/baselines/reference/override5.js index 567a0c6c6c176..13f64cbcae86e 100644 --- a/tests/baselines/reference/override5.js +++ b/tests/baselines/reference/override5.js @@ -47,7 +47,7 @@ abstract class AND { } class ADD extends AD { - override f(): void { + f(): void { } override b(): void { @@ -150,6 +150,6 @@ declare abstract class AND { abstract override b(): void; } declare class ADD extends AD { - override f(): void; + f(): void; override b(): void; } diff --git a/tests/baselines/reference/override5.symbols b/tests/baselines/reference/override5.symbols index f1d0dc943b78f..9f504d682652e 100644 --- a/tests/baselines/reference/override5.symbols +++ b/tests/baselines/reference/override5.symbols @@ -94,7 +94,7 @@ class ADD extends AD { >ADD : Symbol(ADD, Decl(override5.ts, 45, 1)) >AD : Symbol(AD, Decl(override5.ts, 35, 1)) - override f(): void { + f(): void { >f : Symbol(ADD.f, Decl(override5.ts, 47, 22)) } diff --git a/tests/baselines/reference/override5.types b/tests/baselines/reference/override5.types index 9e59e563fd650..f65d7b3cabb43 100644 --- a/tests/baselines/reference/override5.types +++ b/tests/baselines/reference/override5.types @@ -99,7 +99,7 @@ class ADD extends AD { >ADD : ADD >AD : AD - override f(): void { + f(): void { >f : () => void } diff --git a/tests/cases/conformance/override/override2.ts b/tests/cases/conformance/override/override2.ts index 8f4404842ab04..b04a979001b03 100644 --- a/tests/cases/conformance/override/override2.ts +++ b/tests/cases/conformance/override/override2.ts @@ -3,7 +3,8 @@ abstract class AB { abstract foo(v: string): void; - abstract bar(v: string): void + abstract bar(v: string): void; + abstract baz(v: string): void; } abstract class AD1 extends AB { @@ -17,9 +18,11 @@ abstract class AD2 extends AB { abstract class AD3 extends AB { override foo(v: ''): void { } // need override? abstract bar(): void; + baz(): void { } } class D4 extends AB { override foo(v: ''): void {} override bar(v: ''): void {} + baz(): void { } } \ No newline at end of file diff --git a/tests/cases/conformance/override/override5.ts b/tests/cases/conformance/override/override5.ts index 834484f4ec90e..cd6bd1001c4a6 100644 --- a/tests/cases/conformance/override/override5.ts +++ b/tests/cases/conformance/override/override5.ts @@ -48,7 +48,7 @@ abstract class AND { } class ADD extends AD { - override f(): void { + f(): void { } override b(): void { From bc4d758c67b24c4c75a7f06abfe6a46e23f2112b Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 17 Sep 2020 03:12:48 +0800 Subject: [PATCH 42/61] Avoid override dead lock --- src/compiler/checker.ts | 5 +++-- tests/baselines/reference/override2.errors.txt | 14 +------------- tests/baselines/reference/override5.errors.txt | 5 +---- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 20a2247911428..23ac2d53112b7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -35003,13 +35003,14 @@ namespace ts { error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); } else if (prop && baseProp && compilerOptions.noImplicitOverride && !nodeInAmbientContext) { - if (!hasOverride) { + const baseHasAbstract = hasAbstractModifier(baseProp.valueDeclaration); + if (!hasOverride && !baseHasAbstract) { const diag = memberIsParameterProperty ? Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0 : Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; error(member, diag, baseClassName); } - else if (!hasAbstractModifier(member) && hasAbstractModifier(baseProp.valueDeclaration)) { + else if (hasOverride && !hasAbstractModifier(member) && baseHasAbstract) { error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0, baseClassName); } } diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt index 97709715ff4ea..41266ae11eca5 100644 --- a/tests/baselines/reference/override2.errors.txt +++ b/tests/baselines/reference/override2.errors.txt @@ -1,13 +1,9 @@ -tests/cases/conformance/override/override2.ts(13,14): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. tests/cases/conformance/override/override2.ts(17,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. -tests/cases/conformance/override/override2.ts(18,14): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. -tests/cases/conformance/override/override2.ts(19,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. tests/cases/conformance/override/override2.ts(23,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. tests/cases/conformance/override/override2.ts(24,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. -tests/cases/conformance/override/override2.ts(25,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. -==== tests/cases/conformance/override/override2.ts (7 errors) ==== +==== tests/cases/conformance/override/override2.ts (3 errors) ==== abstract class AB { abstract foo(v: string): void; @@ -21,8 +17,6 @@ tests/cases/conformance/override/override2.ts(25,5): error TS4113: This member m abstract class AD2 extends AB { abstract foo(v: ''): void // need override? - ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. } abstract class AD3 extends AB { @@ -30,11 +24,7 @@ tests/cases/conformance/override/override2.ts(25,5): error TS4113: This member m ~~~ !!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. abstract bar(): void; - ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. baz(): void { } - ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. } class D4 extends AB { @@ -45,6 +35,4 @@ tests/cases/conformance/override/override2.ts(25,5): error TS4113: This member m ~~~ !!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. baz(): void { } - ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AB'. } \ No newline at end of file diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt index d2cdc3d46b73a..99eb1140f15c5 100644 --- a/tests/baselines/reference/override5.errors.txt +++ b/tests/baselines/reference/override5.errors.txt @@ -6,11 +6,10 @@ tests/cases/conformance/override/override5.ts(25,14): error TS1029: 'public' mod tests/cases/conformance/override/override5.ts(27,5): error TS1089: 'override' modifier cannot appear on a constructor declaration. tests/cases/conformance/override/override5.ts(44,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. tests/cases/conformance/override/override5.ts(45,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. -tests/cases/conformance/override/override5.ts(49,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AD'. tests/cases/conformance/override/override5.ts(52,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. -==== tests/cases/conformance/override/override5.ts (10 errors) ==== +==== tests/cases/conformance/override/override5.ts (9 errors) ==== class B { p1: number = 1; p2: number = 2; @@ -76,8 +75,6 @@ tests/cases/conformance/override/override5.ts(52,14): error TS4115: This member class ADD extends AD { f(): void { - ~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'AD'. } override b(): void { From 47296d6dfa67bcfb342705bd6c4125b43289bcf1 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 17 Sep 2020 03:21:15 +0800 Subject: [PATCH 43/61] Add more case --- tests/cases/conformance/override/override10.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/cases/conformance/override/override10.ts diff --git a/tests/cases/conformance/override/override10.ts b/tests/cases/conformance/override/override10.ts new file mode 100644 index 0000000000000..98de0c7f1c6eb --- /dev/null +++ b/tests/cases/conformance/override/override10.ts @@ -0,0 +1,13 @@ +// @declaration: true +// @noImplicitOverride: true + +abstract class Base { + abstract foo(): unknown; + abstract bar(): void; +} + +// No errors: +abstract class Sub extends Base { + override abstract foo(): number; + bar() { } +} \ No newline at end of file From 5d19a902cf7afab54907d959685d65925f1a9e10 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 17 Sep 2020 03:27:26 +0800 Subject: [PATCH 44/61] Add codefix for new error --- src/services/codefixes/fixOverrideModifier.ts | 5 ++ tests/baselines/reference/override10.js | 51 +++++++++++++++++++ tests/baselines/reference/override10.symbols | 22 ++++++++ tests/baselines/reference/override10.types | 22 ++++++++ .../fourslash/codeFixOverrideModifier11.ts | 16 ++++++ 5 files changed, 116 insertions(+) create mode 100644 tests/baselines/reference/override10.js create mode 100644 tests/baselines/reference/override10.symbols create mode 100644 tests/baselines/reference/override10.types create mode 100644 tests/cases/fourslash/codeFixOverrideModifier11.ts diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index 233d7df6fd54a..1bbb97eed3a9d 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -8,6 +8,7 @@ namespace ts.codefix { const errorCodes = [ Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code, Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, + Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0.code, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code, Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0.code ]; @@ -19,6 +20,9 @@ namespace ts.codefix { [Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code]: [ Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier ], + [Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0.code]: [ + Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier + ], [Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]: [ Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier ], @@ -67,6 +71,7 @@ namespace ts.codefix { return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos); case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code: case Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code: + case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0.code: return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos); case Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0.code: return doConvertToPropertyDeclaration(changeTracker, context.sourceFile, pos); diff --git a/tests/baselines/reference/override10.js b/tests/baselines/reference/override10.js new file mode 100644 index 0000000000000..555725c86422b --- /dev/null +++ b/tests/baselines/reference/override10.js @@ -0,0 +1,51 @@ +//// [override10.ts] +abstract class Base { + abstract foo(): unknown; + abstract bar(): void; +} + +// No errors: +abstract class Sub extends Base { + override abstract foo(): number; + bar() { } +} + +//// [override10.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var Base = /** @class */ (function () { + function Base() { + } + return Base; +}()); +// No errors: +var Sub = /** @class */ (function (_super) { + __extends(Sub, _super); + function Sub() { + return _super !== null && _super.apply(this, arguments) || this; + } + Sub.prototype.bar = function () { }; + return Sub; +}(Base)); + + +//// [override10.d.ts] +declare abstract class Base { + abstract foo(): unknown; + abstract bar(): void; +} +declare abstract class Sub extends Base { + override abstract foo(): number; + bar(): void; +} diff --git a/tests/baselines/reference/override10.symbols b/tests/baselines/reference/override10.symbols new file mode 100644 index 0000000000000..99382520fd3bf --- /dev/null +++ b/tests/baselines/reference/override10.symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/override/override10.ts === +abstract class Base { +>Base : Symbol(Base, Decl(override10.ts, 0, 0)) + + abstract foo(): unknown; +>foo : Symbol(Base.foo, Decl(override10.ts, 0, 21)) + + abstract bar(): void; +>bar : Symbol(Base.bar, Decl(override10.ts, 1, 28)) +} + +// No errors: +abstract class Sub extends Base { +>Sub : Symbol(Sub, Decl(override10.ts, 3, 1)) +>Base : Symbol(Base, Decl(override10.ts, 0, 0)) + + override abstract foo(): number; +>foo : Symbol(Sub.foo, Decl(override10.ts, 6, 33)) + + bar() { } +>bar : Symbol(Sub.bar, Decl(override10.ts, 7, 36)) +} diff --git a/tests/baselines/reference/override10.types b/tests/baselines/reference/override10.types new file mode 100644 index 0000000000000..ce42a87972701 --- /dev/null +++ b/tests/baselines/reference/override10.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/override/override10.ts === +abstract class Base { +>Base : Base + + abstract foo(): unknown; +>foo : () => unknown + + abstract bar(): void; +>bar : () => void +} + +// No errors: +abstract class Sub extends Base { +>Sub : Sub +>Base : Base + + override abstract foo(): number; +>foo : () => number + + bar() { } +>bar : () => void +} diff --git a/tests/cases/fourslash/codeFixOverrideModifier11.ts b/tests/cases/fourslash/codeFixOverrideModifier11.ts new file mode 100644 index 0000000000000..9e09922042380 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier11.ts @@ -0,0 +1,16 @@ +/// + +// @noImplicitOverride: true + +//// abstract class Base { +//// abstract bar(): void; +//// } +//// class Sub extends Base { +//// [|override bar() {}|] +//// } + +verify.codeFix({ + description: "Remove 'override' modifier", + newRangeContent: "bar() {}", + index: 0 +}) From 68e1440fe9c7f17786f6035352994cdc493c9119 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 17 Sep 2020 04:02:26 +0800 Subject: [PATCH 45/61] Fix error message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- src/services/codefixes/fixOverrideModifier.ts | 6 +++--- tests/baselines/reference/override6.errors.txt | 8 ++++---- tests/baselines/reference/override8.errors.txt | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 23ac2d53112b7..6d1b66719f739 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -35006,7 +35006,7 @@ namespace ts { const baseHasAbstract = hasAbstractModifier(baseProp.valueDeclaration); if (!hasOverride && !baseHasAbstract) { const diag = memberIsParameterProperty ? - Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0 : + Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0 : Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; error(member, diag, baseClassName); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 83e017e561352..a8cb615dabb35 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3424,7 +3424,7 @@ "category": "Error", "code": 4113 }, - "This parameter must convert into property declaration because it overrides a member in the base class '{0}'.": { + "This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class '{0}'.": { "category": "Error", "code": 4114 }, diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index 1bbb97eed3a9d..e5c6a598147ad 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -10,7 +10,7 @@ namespace ts.codefix { Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0.code, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code, - Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0.code + Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code ]; const errorCodeFixIdMap: Record = { @@ -26,7 +26,7 @@ namespace ts.codefix { [Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]: [ Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier ], - [Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0.code]: [ + [Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code]: [ Diagnostics.Convert_to_property_declaration_and_add_override_modifier, fixConvertToPropertyDeclarationId, Diagnostics.Convert_all_to_property_declaration_and_add_override_modifier @@ -73,7 +73,7 @@ namespace ts.codefix { case Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code: case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0.code: return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos); - case Diagnostics.This_parameter_must_convert_into_property_declaration_because_it_overrides_a_member_in_the_base_class_0.code: + case Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code: return doConvertToPropertyDeclaration(changeTracker, context.sourceFile, pos); default: Debug.fail("Unexpected error code: " + errorCode); diff --git a/tests/baselines/reference/override6.errors.txt b/tests/baselines/reference/override6.errors.txt index a71742252f0a6..1df81128ae094 100644 --- a/tests/baselines/reference/override6.errors.txt +++ b/tests/baselines/reference/override6.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/override/override6.ts(9,12): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override6.ts(10,17): error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override6.ts(10,37): error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override6.ts(10,17): error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. +tests/cases/conformance/override/override6.ts(10,37): error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. ==== tests/cases/conformance/override/override6.ts (3 errors) ==== @@ -17,9 +17,9 @@ tests/cases/conformance/override/override6.ts(10,37): error TS4114: This paramet !!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. constructor(public foo: string, public baz: number) { ~~~~~~~~~~~~~~~~~~ -!!! error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. +!!! error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. ~~~~~~~~~~~~~~~~~~ -!!! error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. +!!! error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. super(foo, 42) } } diff --git a/tests/baselines/reference/override8.errors.txt b/tests/baselines/reference/override8.errors.txt index 07736c67f66eb..5e2390d6d1919 100644 --- a/tests/baselines/reference/override8.errors.txt +++ b/tests/baselines/reference/override8.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/override/override8.ts(6,17): error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override8.ts(18,17): error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'BB'. +tests/cases/conformance/override/override8.ts(6,17): error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. +tests/cases/conformance/override/override8.ts(18,17): error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'BB'. tests/cases/conformance/override/override8.ts(24,12): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'BB'. @@ -11,7 +11,7 @@ tests/cases/conformance/override/override8.ts(24,12): error TS4113: This member class D extends B { constructor(public a: string, public b: string) { ~~~~~~~~~~~~~~~~ -!!! error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'B'. +!!! error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. super(); } } @@ -25,7 +25,7 @@ tests/cases/conformance/override/override8.ts(24,12): error TS4113: This member class DD extends BB { constructor(public a: string) { ~~~~~~~~~~~~~~~~ -!!! error TS4114: This parameter must convert into property declaration because it overrides a member in the base class 'BB'. +!!! error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'BB'. super(a) } } From 2552495f557345398977eab0bb19d6135f79233f Mon Sep 17 00:00:00 2001 From: Wenlu Wang Date: Mon, 2 Nov 2020 14:18:08 +0800 Subject: [PATCH 46/61] Add jsdoc override tag (#6) --- src/compiler/factory/nodeFactory.ts | 2 + src/compiler/factory/nodeTests.ts | 4 ++ src/compiler/parser.ts | 4 ++ src/compiler/types.ts | 7 ++ src/compiler/utilities.ts | 3 +- src/compiler/utilitiesPublic.ts | 4 ++ .../reference/jsdocOverrideTag1.errors.txt | 55 +++++++++++++++ .../reference/jsdocOverrideTag1.symbols | 65 +++++++++++++++++ .../reference/jsdocOverrideTag1.types | 69 +++++++++++++++++++ .../conformance/jsdoc/jsdocOverrideTag1.ts | 49 +++++++++++++ 10 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/jsdocOverrideTag1.errors.txt create mode 100644 tests/baselines/reference/jsdocOverrideTag1.symbols create mode 100644 tests/baselines/reference/jsdocOverrideTag1.types create mode 100644 tests/cases/conformance/jsdoc/jsdocOverrideTag1.ts diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 89d738b6726c0..40b64aae0e290 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -366,6 +366,8 @@ namespace ts { get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocProtectedTag); }, get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(SyntaxKind.JSDocReadonlyTag); }, get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocReadonlyTag); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(SyntaxKind.JSDocOverrideTag); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocOverrideTag); }, get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(SyntaxKind.JSDocDeprecatedTag); }, get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(SyntaxKind.JSDocDeprecatedTag); }, createJSDocUnknownTag, diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 3f334edc0d61b..9c56bd360d2b5 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -785,6 +785,10 @@ namespace ts { return node.kind === SyntaxKind.JSDocReadonlyTag; } + export function isJSDocOverrideTag(node: Node): node is JSDocOverrideTag { + return node.kind === SyntaxKind.JSDocOverrideTag; + } + export function isJSDocDeprecatedTag(node: Node): node is JSDocDeprecatedTag { return node.kind === SyntaxKind.JSDocDeprecatedTag; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 722604bb3e2f6..f2cfb948d1373 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -537,6 +537,7 @@ namespace ts { case SyntaxKind.JSDocPrivateTag: case SyntaxKind.JSDocProtectedTag: case SyntaxKind.JSDocReadonlyTag: + case SyntaxKind.JSDocOverrideTag: return visitNode(cbNode, (node as JSDocTag).tagName); case SyntaxKind.PartiallyEmittedExpression: return visitNode(cbNode, (node).expression); @@ -7466,6 +7467,9 @@ namespace ts { case "readonly": tag = parseSimpleTag(start, factory.createJSDocReadonlyTag, tagName, margin, indentText); break; + case "override": + tag = parseSimpleTag(start, factory.createJSDocOverrideTag, tagName, margin, indentText); + break; case "deprecated": hasDeprecatedTag = true; tag = parseSimpleTag(start, factory.createJSDocDeprecatedTag, tagName, margin, indentText); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f68786c4aa295..649a31887d2c6 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -386,6 +386,7 @@ namespace ts { JSDocPrivateTag, JSDocProtectedTag, JSDocReadonlyTag, + JSDocOverrideTag, JSDocCallbackTag, JSDocEnumTag, JSDocParameterTag, @@ -3198,6 +3199,10 @@ namespace ts { readonly kind: SyntaxKind.JSDocReadonlyTag; } + export interface JSDocOverrideTag extends JSDocTag { + readonly kind: SyntaxKind.JSDocOverrideTag; + } + export interface JSDocEnumTag extends JSDocTag, Declaration { readonly kind: SyntaxKind.JSDocEnumTag; readonly parent: JSDoc; @@ -7093,6 +7098,8 @@ namespace ts { updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | undefined): JSDocProtectedTag; createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string): JSDocReadonlyTag; updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | undefined): JSDocReadonlyTag; + createJSDocOverrideTag(tagName: Identifier | undefined, comment?: string): JSDocOverrideTag; + updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier | undefined, comment: string | undefined): JSDocOverrideTag; createJSDocUnknownTag(tagName: Identifier, comment?: string): JSDocUnknownTag; updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | undefined): JSDocUnknownTag; createJSDocDeprecatedTag(tagName: Identifier, comment?: string): JSDocDeprecatedTag; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index bb323c8dac106..2e466e0827eb9 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4610,7 +4610,7 @@ namespace ts { } export function hasOverrideModifier(node: Node): boolean { - return hasSyntacticModifier(node, ModifierFlags.Override); + return hasEffectiveModifier(node, ModifierFlags.Override); } export function hasAbstractModifier(node: Node): boolean { @@ -4679,6 +4679,7 @@ namespace ts { if (getJSDocPrivateTagNoCache(node)) flags |= ModifierFlags.Private; if (getJSDocProtectedTagNoCache(node)) flags |= ModifierFlags.Protected; if (getJSDocReadonlyTagNoCache(node)) flags |= ModifierFlags.Readonly; + if (getJSDocOverrideTagNoCache(node)) flags |= ModifierFlags.Override; } if (getJSDocDeprecatedTagNoCache(node)) flags |= ModifierFlags.Deprecated; } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index e6d320b191e19..964ee5a3f89e9 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -767,6 +767,10 @@ namespace ts { return getFirstJSDocTag(node, isJSDocReadonlyTag, /*noCache*/ true); } + export function getJSDocOverrideTagNoCache(node: Node): JSDocOverrideTag | undefined { + return getFirstJSDocTag(node, isJSDocOverrideTag, /*noCache*/ true); + } + /** Gets the JSDoc deprecated tag for the node if present */ export function getJSDocDeprecatedTag(node: Node): JSDocDeprecatedTag | undefined { return getFirstJSDocTag(node, isJSDocDeprecatedTag); diff --git a/tests/baselines/reference/jsdocOverrideTag1.errors.txt b/tests/baselines/reference/jsdocOverrideTag1.errors.txt new file mode 100644 index 0000000000000..482732ca41946 --- /dev/null +++ b/tests/baselines/reference/jsdocOverrideTag1.errors.txt @@ -0,0 +1,55 @@ +tests/cases/conformance/jsdoc/0.js(27,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'A'. +tests/cases/conformance/jsdoc/0.js(32,5): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. +tests/cases/conformance/jsdoc/0.js(40,5): error TS4111: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. + + +==== tests/cases/conformance/jsdoc/0.js (3 errors) ==== + class A { + + /** + * @method + * @param {string | number} a + * @returns {boolean} + */ + foo (a) { + return typeof a === 'string' + } + bar () { + + } + } + + class B extends A { + /** + * @override + * @method + * @param {string | number} a + * @returns {boolean} + */ + foo (a) { + return super.foo(a) + } + + bar () { + ~~~ +!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'A'. + + } + + /** @override */ + baz () { + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. + + } + } + + + class C { + /** @override */ + foo () { + ~~~ +!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. + + } + } \ No newline at end of file diff --git a/tests/baselines/reference/jsdocOverrideTag1.symbols b/tests/baselines/reference/jsdocOverrideTag1.symbols new file mode 100644 index 0000000000000..8496b1024fc6a --- /dev/null +++ b/tests/baselines/reference/jsdocOverrideTag1.symbols @@ -0,0 +1,65 @@ +=== tests/cases/conformance/jsdoc/0.js === +class A { +>A : Symbol(A, Decl(0.js, 0, 0)) + + /** + * @method + * @param {string | number} a + * @returns {boolean} + */ + foo (a) { +>foo : Symbol(A.foo, Decl(0.js, 0, 9)) +>a : Symbol(a, Decl(0.js, 7, 9)) + + return typeof a === 'string' +>a : Symbol(a, Decl(0.js, 7, 9)) + } + bar () { +>bar : Symbol(A.bar, Decl(0.js, 9, 5)) + + } +} + +class B extends A { +>B : Symbol(B, Decl(0.js, 13, 1)) +>A : Symbol(A, Decl(0.js, 0, 0)) + + /** + * @override + * @method + * @param {string | number} a + * @returns {boolean} + */ + foo (a) { +>foo : Symbol(B.foo, Decl(0.js, 15, 19)) +>a : Symbol(a, Decl(0.js, 22, 9)) + + return super.foo(a) +>super.foo : Symbol(A.foo, Decl(0.js, 0, 9)) +>super : Symbol(A, Decl(0.js, 0, 0)) +>foo : Symbol(A.foo, Decl(0.js, 0, 9)) +>a : Symbol(a, Decl(0.js, 22, 9)) + } + + bar () { +>bar : Symbol(B.bar, Decl(0.js, 24, 5)) + + } + + /** @override */ + baz () { +>baz : Symbol(B.baz, Decl(0.js, 28, 5)) + + } +} + + +class C { +>C : Symbol(C, Decl(0.js, 34, 1)) + + /** @override */ + foo () { +>foo : Symbol(C.foo, Decl(0.js, 37, 9)) + + } +} diff --git a/tests/baselines/reference/jsdocOverrideTag1.types b/tests/baselines/reference/jsdocOverrideTag1.types new file mode 100644 index 0000000000000..f450dd56b8d5e --- /dev/null +++ b/tests/baselines/reference/jsdocOverrideTag1.types @@ -0,0 +1,69 @@ +=== tests/cases/conformance/jsdoc/0.js === +class A { +>A : A + + /** + * @method + * @param {string | number} a + * @returns {boolean} + */ + foo (a) { +>foo : (a: string | number) => boolean +>a : string | number + + return typeof a === 'string' +>typeof a === 'string' : boolean +>typeof a : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>a : string | number +>'string' : "string" + } + bar () { +>bar : () => void + + } +} + +class B extends A { +>B : B +>A : A + + /** + * @override + * @method + * @param {string | number} a + * @returns {boolean} + */ + foo (a) { +>foo : (a: string | number) => boolean +>a : string | number + + return super.foo(a) +>super.foo(a) : boolean +>super.foo : (a: string | number) => boolean +>super : A +>foo : (a: string | number) => boolean +>a : string | number + } + + bar () { +>bar : () => void + + } + + /** @override */ + baz () { +>baz : () => void + + } +} + + +class C { +>C : C + + /** @override */ + foo () { +>foo : () => void + + } +} diff --git a/tests/cases/conformance/jsdoc/jsdocOverrideTag1.ts b/tests/cases/conformance/jsdoc/jsdocOverrideTag1.ts new file mode 100644 index 0000000000000..92256baf702fe --- /dev/null +++ b/tests/cases/conformance/jsdoc/jsdocOverrideTag1.ts @@ -0,0 +1,49 @@ +// @allowJS: true +// @checkJS: true +// @noEmit: true +// @noImplicitOverride: true +// @Filename: 0.js + +class A { + + /** + * @method + * @param {string | number} a + * @returns {boolean} + */ + foo (a) { + return typeof a === 'string' + } + bar () { + + } +} + +class B extends A { + /** + * @override + * @method + * @param {string | number} a + * @returns {boolean} + */ + foo (a) { + return super.foo(a) + } + + bar () { + + } + + /** @override */ + baz () { + + } +} + + +class C { + /** @override */ + foo () { + + } +} \ No newline at end of file From cf5dc7e85d6910ebe9ca2d6c2af3889eaf6c6486 Mon Sep 17 00:00:00 2001 From: Wenlu Wang Date: Mon, 2 Nov 2020 15:05:15 +0800 Subject: [PATCH 47/61] Override jsdoc tag (#7) * accept baseline --- .../reference/api/tsserverlibrary.d.ts | 48 +++++++++++-------- tests/baselines/reference/api/typescript.d.ts | 48 +++++++++++-------- 2 files changed, 56 insertions(+), 40 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 9198c74adea4e..9f1e4d4257048 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -429,24 +429,25 @@ declare namespace ts { JSDocPrivateTag = 322, JSDocProtectedTag = 323, JSDocReadonlyTag = 324, - JSDocCallbackTag = 325, - JSDocEnumTag = 326, - JSDocParameterTag = 327, - JSDocReturnTag = 328, - JSDocThisTag = 329, - JSDocTypeTag = 330, - JSDocTemplateTag = 331, - JSDocTypedefTag = 332, - JSDocSeeTag = 333, - JSDocPropertyTag = 334, - SyntaxList = 335, - NotEmittedStatement = 336, - PartiallyEmittedExpression = 337, - CommaListExpression = 338, - MergeDeclarationMarker = 339, - EndOfDeclarationMarker = 340, - SyntheticReferenceExpression = 341, - Count = 342, + JSDocOverrideTag = 325, + JSDocCallbackTag = 326, + JSDocEnumTag = 327, + JSDocParameterTag = 328, + JSDocReturnTag = 329, + JSDocThisTag = 330, + JSDocTypeTag = 331, + JSDocTemplateTag = 332, + JSDocTypedefTag = 333, + JSDocSeeTag = 334, + JSDocPropertyTag = 335, + SyntaxList = 336, + NotEmittedStatement = 337, + PartiallyEmittedExpression = 338, + CommaListExpression = 339, + MergeDeclarationMarker = 340, + EndOfDeclarationMarker = 341, + SyntheticReferenceExpression = 342, + Count = 343, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -475,9 +476,9 @@ declare namespace ts { LastStatement = 249, FirstNode = 158, FirstJSDocNode = 302, - LastJSDocNode = 334, + LastJSDocNode = 335, FirstJSDocTagNode = 315, - LastJSDocTagNode = 334, + LastJSDocTagNode = 335, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -1791,6 +1792,9 @@ declare namespace ts { export interface JSDocReadonlyTag extends JSDocTag { readonly kind: SyntaxKind.JSDocReadonlyTag; } + export interface JSDocOverrideTag extends JSDocTag { + readonly kind: SyntaxKind.JSDocOverrideTag; + } export interface JSDocEnumTag extends JSDocTag, Declaration { readonly kind: SyntaxKind.JSDocEnumTag; readonly parent: JSDoc; @@ -3493,6 +3497,8 @@ declare namespace ts { updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | undefined): JSDocProtectedTag; createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string): JSDocReadonlyTag; updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | undefined): JSDocReadonlyTag; + createJSDocOverrideTag(tagName: Identifier | undefined, comment?: string): JSDocOverrideTag; + updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier | undefined, comment: string | undefined): JSDocOverrideTag; createJSDocUnknownTag(tagName: Identifier, comment?: string): JSDocUnknownTag; updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | undefined): JSDocUnknownTag; createJSDocDeprecatedTag(tagName: Identifier, comment?: string): JSDocDeprecatedTag; @@ -4143,6 +4149,7 @@ declare namespace ts { function getJSDocProtectedTag(node: Node): JSDocProtectedTag | undefined; /** Gets the JSDoc protected tag for the node if present */ function getJSDocReadonlyTag(node: Node): JSDocReadonlyTag | undefined; + function getJSDocOverrideTagNoCache(node: Node): JSDocOverrideTag | undefined; /** Gets the JSDoc deprecated tag for the node if present */ function getJSDocDeprecatedTag(node: Node): JSDocDeprecatedTag | undefined; /** Gets the JSDoc enum tag for the node if present */ @@ -4508,6 +4515,7 @@ declare namespace ts { function isJSDocPrivateTag(node: Node): node is JSDocPrivateTag; function isJSDocProtectedTag(node: Node): node is JSDocProtectedTag; function isJSDocReadonlyTag(node: Node): node is JSDocReadonlyTag; + function isJSDocOverrideTag(node: Node): node is JSDocOverrideTag; function isJSDocDeprecatedTag(node: Node): node is JSDocDeprecatedTag; function isJSDocEnumTag(node: Node): node is JSDocEnumTag; function isJSDocParameterTag(node: Node): node is JSDocParameterTag; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index d9d3fdea55af5..8780cea7b20c3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -429,24 +429,25 @@ declare namespace ts { JSDocPrivateTag = 322, JSDocProtectedTag = 323, JSDocReadonlyTag = 324, - JSDocCallbackTag = 325, - JSDocEnumTag = 326, - JSDocParameterTag = 327, - JSDocReturnTag = 328, - JSDocThisTag = 329, - JSDocTypeTag = 330, - JSDocTemplateTag = 331, - JSDocTypedefTag = 332, - JSDocSeeTag = 333, - JSDocPropertyTag = 334, - SyntaxList = 335, - NotEmittedStatement = 336, - PartiallyEmittedExpression = 337, - CommaListExpression = 338, - MergeDeclarationMarker = 339, - EndOfDeclarationMarker = 340, - SyntheticReferenceExpression = 341, - Count = 342, + JSDocOverrideTag = 325, + JSDocCallbackTag = 326, + JSDocEnumTag = 327, + JSDocParameterTag = 328, + JSDocReturnTag = 329, + JSDocThisTag = 330, + JSDocTypeTag = 331, + JSDocTemplateTag = 332, + JSDocTypedefTag = 333, + JSDocSeeTag = 334, + JSDocPropertyTag = 335, + SyntaxList = 336, + NotEmittedStatement = 337, + PartiallyEmittedExpression = 338, + CommaListExpression = 339, + MergeDeclarationMarker = 340, + EndOfDeclarationMarker = 341, + SyntheticReferenceExpression = 342, + Count = 343, FirstAssignment = 62, LastAssignment = 77, FirstCompoundAssignment = 63, @@ -475,9 +476,9 @@ declare namespace ts { LastStatement = 249, FirstNode = 158, FirstJSDocNode = 302, - LastJSDocNode = 334, + LastJSDocNode = 335, FirstJSDocTagNode = 315, - LastJSDocTagNode = 334, + LastJSDocTagNode = 335, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -1791,6 +1792,9 @@ declare namespace ts { export interface JSDocReadonlyTag extends JSDocTag { readonly kind: SyntaxKind.JSDocReadonlyTag; } + export interface JSDocOverrideTag extends JSDocTag { + readonly kind: SyntaxKind.JSDocOverrideTag; + } export interface JSDocEnumTag extends JSDocTag, Declaration { readonly kind: SyntaxKind.JSDocEnumTag; readonly parent: JSDoc; @@ -3493,6 +3497,8 @@ declare namespace ts { updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | undefined): JSDocProtectedTag; createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string): JSDocReadonlyTag; updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | undefined): JSDocReadonlyTag; + createJSDocOverrideTag(tagName: Identifier | undefined, comment?: string): JSDocOverrideTag; + updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier | undefined, comment: string | undefined): JSDocOverrideTag; createJSDocUnknownTag(tagName: Identifier, comment?: string): JSDocUnknownTag; updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | undefined): JSDocUnknownTag; createJSDocDeprecatedTag(tagName: Identifier, comment?: string): JSDocDeprecatedTag; @@ -4143,6 +4149,7 @@ declare namespace ts { function getJSDocProtectedTag(node: Node): JSDocProtectedTag | undefined; /** Gets the JSDoc protected tag for the node if present */ function getJSDocReadonlyTag(node: Node): JSDocReadonlyTag | undefined; + function getJSDocOverrideTagNoCache(node: Node): JSDocOverrideTag | undefined; /** Gets the JSDoc deprecated tag for the node if present */ function getJSDocDeprecatedTag(node: Node): JSDocDeprecatedTag | undefined; /** Gets the JSDoc enum tag for the node if present */ @@ -4508,6 +4515,7 @@ declare namespace ts { function isJSDocPrivateTag(node: Node): node is JSDocPrivateTag; function isJSDocProtectedTag(node: Node): node is JSDocProtectedTag; function isJSDocReadonlyTag(node: Node): node is JSDocReadonlyTag; + function isJSDocOverrideTag(node: Node): node is JSDocOverrideTag; function isJSDocDeprecatedTag(node: Node): node is JSDocDeprecatedTag; function isJSDocEnumTag(node: Node): node is JSDocEnumTag; function isJSDocParameterTag(node: Node): node is JSDocParameterTag; From b65d244c7d77983f475d25d1dabed4cc0497b5c9 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 2 Nov 2020 16:54:24 +0800 Subject: [PATCH 48/61] Disallow codefix in js --- src/compiler/factory/nodeFactory.ts | 1 + src/services/codefixes/fixOverrideModifier.ts | 35 ++++++++++++++++--- .../fourslash/codeFixOverrideModifier_js1.ts | 22 ++++++++++++ 3 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 tests/cases/fourslash/codeFixOverrideModifier_js1.ts diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 40b64aae0e290..18bca23d47fdd 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -5864,6 +5864,7 @@ namespace ts { case SyntaxKind.JSDocPrivateTag: return "private"; case SyntaxKind.JSDocProtectedTag: return "protected"; case SyntaxKind.JSDocReadonlyTag: return "readonly"; + case SyntaxKind.JSDocOverrideTag: return "override"; case SyntaxKind.JSDocTemplateTag: return "template"; case SyntaxKind.JSDocTypedefTag: return "typedef"; case SyntaxKind.JSDocParameterTag: return "param"; diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index e5c6a598147ad..a39db3ac7b1e4 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -5,6 +5,13 @@ namespace ts.codefix { const fixRemoveOverrideId = "fixRemoveOverrideModifier"; const fixConvertToPropertyDeclarationId = "fixConvertToPropertyDeclaration"; + type ClassElementHasJSDoc = + | ConstructorDeclaration + | PropertyDeclaration + | MethodDeclaration + | GetAccessorDeclaration + | SetAccessorDeclaration; + const errorCodes = [ Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code, Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, @@ -36,12 +43,13 @@ namespace ts.codefix { registerCodeFix({ errorCodes, getCodeActions: context => { - const { errorCode, span } = context; + const { errorCode, span, sourceFile } = context; const info = errorCodeFixIdMap[errorCode]; if (!info) return emptyArray; const [ descriptions, fixId, fixAllDescriptions ] = info; + if (isSourceFileJS(sourceFile)) return emptyArray; const changes = textChanges.ChangeTracker.with(context, changes => dispatchChanges(changes, context, errorCode, span.start)); return [ @@ -51,9 +59,9 @@ namespace ts.codefix { fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId, fixConvertToPropertyDeclarationId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { - const { code, start } = diag; + const { code, start, file } = diag; const info = errorCodeFixIdMap[code]; - if (!info || info[1] !== context.fixId) { + if (!info || info[1] !== context.fixId || isSourceFileJS(file)) { return; } @@ -102,10 +110,27 @@ namespace ts.codefix { getConvertParameterPropertyToPropertyChanges(changeTracker, sourceFile, info, ModifierFlags.Override); } + function isClassElementHasJSDoc(node: Node): node is ClassElementHasJSDoc { + switch (node.kind) { + case SyntaxKind.Constructor: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return true; + default: + return false; + } + } + function findContainerClassElement(sourceFile: SourceFile, pos: number) { const token = getTokenAtPosition(sourceFile, pos); - const classElement = findAncestor(token, isClassElement); - Debug.assertIsDefined(classElement); + const classElement = findAncestor(token, node => { + if (isClassLike(node)) return "quit"; + return isClassElementHasJSDoc(node); + }); + + Debug.assert(classElement && isClassElementHasJSDoc(classElement)); return classElement; } } diff --git a/tests/cases/fourslash/codeFixOverrideModifier_js1.ts b/tests/cases/fourslash/codeFixOverrideModifier_js1.ts new file mode 100644 index 0000000000000..bc26610ae6d14 --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier_js1.ts @@ -0,0 +1,22 @@ +/// + +// @allowJs: true +// @checkJs: true +// @noEmit: true +// @noImplicitOverride: true +// @filename: a.js +//// class B { +//// foo (v) {} +//// } +//// class D extends B { +//// foo (v) {} +//// /**@override*/ +//// bar (v) {} +//// } +//// class C { +//// /**@override*/ +//// foo () {} +//// } + +verify.not.codeFixAvailable("Add 'override' modifier"); +verify.not.codeFixAvailable("Remove 'override' modifier"); From 6d89a7ac8915c4cbbb1196eb197f080b76196c2e Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 5 Nov 2020 23:07:35 +0800 Subject: [PATCH 49/61] update baseline --- .../baselines/reference/override1.errors.txt | 32 +++++++++---------- .../baselines/reference/override2.errors.txt | 12 +++---- .../baselines/reference/override3.errors.txt | 4 +-- .../baselines/reference/override4.errors.txt | 16 +++++----- .../baselines/reference/override5.errors.txt | 16 +++++----- .../baselines/reference/override6.errors.txt | 12 +++---- .../baselines/reference/override7.errors.txt | 20 ++++++------ .../baselines/reference/override8.errors.txt | 12 +++---- ...rrideWithoutNoImplicitOverride1.errors.txt | 20 ++++++------ 9 files changed, 72 insertions(+), 72 deletions(-) diff --git a/tests/baselines/reference/override1.errors.txt b/tests/baselines/reference/override1.errors.txt index afe6575828def..04b0333523e2a 100644 --- a/tests/baselines/reference/override1.errors.txt +++ b/tests/baselines/reference/override1.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/override/override1.ts(9,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override1.ts(11,14): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. -tests/cases/conformance/override/override1.ts(15,14): error TS4111: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. -tests/cases/conformance/override/override1.ts(22,9): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override1.ts(24,18): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. -tests/cases/conformance/override/override1.ts(33,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class '(Anonymous class)'. -tests/cases/conformance/override/override1.ts(37,14): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class '(Anonymous class)'. -tests/cases/conformance/override/override1.ts(42,18): error TS4111: This member cannot have an 'override' modifier because its containing class '(Anonymous class)' does not extend another class. +tests/cases/conformance/override/override1.ts(9,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override1.ts(11,14): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override1.ts(15,14): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. +tests/cases/conformance/override/override1.ts(22,9): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override1.ts(24,18): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override1.ts(33,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class '(Anonymous class)'. +tests/cases/conformance/override/override1.ts(37,14): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class '(Anonymous class)'. +tests/cases/conformance/override/override1.ts(42,18): error TS4112: This member cannot have an 'override' modifier because its containing class '(Anonymous class)' does not extend another class. ==== tests/cases/conformance/override/override1.ts (8 errors) ==== @@ -19,17 +19,17 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: This member fooo (v: string) {} ~~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override bar(v: string) {} ~~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. } class C { override foo(v: string) {} ~~~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. } function f () { @@ -38,11 +38,11 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: This member fooo (v: string) {} ~~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override bar(v: string) {} ~~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. } } @@ -53,19 +53,19 @@ tests/cases/conformance/override/override1.ts(42,18): error TS4111: This member override foo () { } bar () { } ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class '(Anonymous class)'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class '(Anonymous class)'. baz() {} override bazz () {} ~~~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class '(Anonymous class)'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class '(Anonymous class)'. } function ff () { return class { override foo () {} ~~~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class '(Anonymous class)' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class '(Anonymous class)' does not extend another class. } } \ No newline at end of file diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt index 41266ae11eca5..62ef1bd93f889 100644 --- a/tests/baselines/reference/override2.errors.txt +++ b/tests/baselines/reference/override2.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/override/override2.ts(17,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. -tests/cases/conformance/override/override2.ts(23,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. -tests/cases/conformance/override/override2.ts(24,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(17,14): error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(23,14): error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(24,14): error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. ==== tests/cases/conformance/override/override2.ts (3 errors) ==== @@ -22,7 +22,7 @@ tests/cases/conformance/override/override2.ts(24,14): error TS4115: This member abstract class AD3 extends AB { override foo(v: ''): void { } // need override? ~~~ -!!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +!!! error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. abstract bar(): void; baz(): void { } } @@ -30,9 +30,9 @@ tests/cases/conformance/override/override2.ts(24,14): error TS4115: This member class D4 extends AB { override foo(v: ''): void {} ~~~ -!!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +!!! error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. override bar(v: ''): void {} ~~~ -!!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +!!! error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. baz(): void { } } \ No newline at end of file diff --git a/tests/baselines/reference/override3.errors.txt b/tests/baselines/reference/override3.errors.txt index 30a26d4181fed..b3d1c98b2f76d 100644 --- a/tests/baselines/reference/override3.errors.txt +++ b/tests/baselines/reference/override3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override3.ts(22,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'D'. +tests/cases/conformance/override/override3.ts(22,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'D'. ==== tests/cases/conformance/override/override3.ts (1 errors) ==== @@ -25,7 +25,7 @@ tests/cases/conformance/override/override3.ts(22,5): error TS4113: This member m class EB extends D { foo(): void {} ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'D'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'D'. override bar(): void {} } \ No newline at end of file diff --git a/tests/baselines/reference/override4.errors.txt b/tests/baselines/reference/override4.errors.txt index 7b66a1e1e1cab..baec00687f13f 100644 --- a/tests/baselines/reference/override4.errors.txt +++ b/tests/baselines/reference/override4.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/override/override4.ts(11,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override4.ts(13,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override4.ts(17,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override4.ts(23,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override4.ts(11,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override4.ts(13,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override4.ts(17,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override4.ts(23,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. ==== tests/cases/conformance/override/override4.ts (4 errors) ==== @@ -17,17 +17,17 @@ tests/cases/conformance/override/override4.ts(23,5): error TS4113: This member m class D extends B { p1: number = 2; ~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override p2: number = 3; p3: () => void; ~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override p4: () => void; override foo (v: string) {} fooo (v: string) {} ~~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. } @@ -35,5 +35,5 @@ tests/cases/conformance/override/override4.ts(23,5): error TS4113: This member m override foo: () => void fooo: () => void; ~~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. } \ No newline at end of file diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt index 99eb1140f15c5..2f2c41d288580 100644 --- a/tests/baselines/reference/override5.errors.txt +++ b/tests/baselines/reference/override5.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/override/override5.ts(12,13): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override5.ts(12,13): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. tests/cases/conformance/override/override5.ts(14,14): error TS1040: 'override' modifier cannot be used in an ambient context. tests/cases/conformance/override/override5.ts(20,14): error TS1243: 'static' modifier cannot be used with 'override' modifier. tests/cases/conformance/override/override5.ts(22,14): error TS1030: 'override' modifier already seen. tests/cases/conformance/override/override5.ts(25,14): error TS1029: 'public' modifier must precede 'override' modifier. tests/cases/conformance/override/override5.ts(27,5): error TS1089: 'override' modifier cannot appear on a constructor declaration. -tests/cases/conformance/override/override5.ts(44,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. -tests/cases/conformance/override/override5.ts(45,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. -tests/cases/conformance/override/override5.ts(52,14): error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. +tests/cases/conformance/override/override5.ts(44,23): error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +tests/cases/conformance/override/override5.ts(45,23): error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +tests/cases/conformance/override/override5.ts(52,14): error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. ==== tests/cases/conformance/override/override5.ts (9 errors) ==== @@ -23,7 +23,7 @@ tests/cases/conformance/override/override5.ts(52,14): error TS4115: This member class D extends B{ declare p1: number ~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. override declare p2: number; ~~~~~~~ @@ -67,10 +67,10 @@ tests/cases/conformance/override/override5.ts(52,14): error TS4115: This member abstract class AND { override abstract f(): void; ~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. abstract override b(): void; ~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. } class ADD extends AD { @@ -79,7 +79,7 @@ tests/cases/conformance/override/override5.ts(52,14): error TS4115: This member } override b(): void { ~ -!!! error TS4115: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. +!!! error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. } } diff --git a/tests/baselines/reference/override6.errors.txt b/tests/baselines/reference/override6.errors.txt index 1df81128ae094..cd05376f2a63f 100644 --- a/tests/baselines/reference/override6.errors.txt +++ b/tests/baselines/reference/override6.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/override/override6.ts(9,12): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -tests/cases/conformance/override/override6.ts(10,17): error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. -tests/cases/conformance/override/override6.ts(10,37): error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. +tests/cases/conformance/override/override6.ts(9,12): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/override6.ts(10,17): error TS4115: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. +tests/cases/conformance/override/override6.ts(10,37): error TS4115: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. ==== tests/cases/conformance/override/override6.ts (3 errors) ==== @@ -14,12 +14,12 @@ tests/cases/conformance/override/override6.ts(10,37): error TS4114: This paramet class D extends B { public bar: number = 1 ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. constructor(public foo: string, public baz: number) { ~~~~~~~~~~~~~~~~~~ -!!! error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. +!!! error TS4115: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. ~~~~~~~~~~~~~~~~~~ -!!! error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. +!!! error TS4115: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. super(foo, 42) } } diff --git a/tests/baselines/reference/override7.errors.txt b/tests/baselines/reference/override7.errors.txt index 949fda941ec2d..69e96245c3b1c 100644 --- a/tests/baselines/reference/override7.errors.txt +++ b/tests/baselines/reference/override7.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/override/override7.ts(19,14): error TS1030: 'override' modifier already seen. -tests/cases/conformance/override/override7.ts(19,23): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. -tests/cases/conformance/override/override7.ts(21,21): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. -tests/cases/conformance/override/override7.ts(22,21): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. -tests/cases/conformance/override/override7.ts(41,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. -tests/cases/conformance/override/override7.ts(42,23): error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +tests/cases/conformance/override/override7.ts(19,23): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override7.ts(21,21): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override7.ts(22,21): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/override7.ts(41,23): error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +tests/cases/conformance/override/override7.ts(42,23): error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. ==== tests/cases/conformance/override/override7.ts (6 errors) ==== @@ -29,14 +29,14 @@ tests/cases/conformance/override/override7.ts(42,23): error TS4111: This member ~~~~~~~~ !!! error TS1030: 'override' modifier already seen. ~~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. public override pp: number; ~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. override public op: number; ~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. override constructor () { super(); @@ -57,10 +57,10 @@ tests/cases/conformance/override/override7.ts(42,23): error TS4111: This member abstract class AND { override abstract f(): void; ~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. abstract override b(): void; ~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. } class ADD extends AD { diff --git a/tests/baselines/reference/override8.errors.txt b/tests/baselines/reference/override8.errors.txt index 5e2390d6d1919..f1b2fa8654b5f 100644 --- a/tests/baselines/reference/override8.errors.txt +++ b/tests/baselines/reference/override8.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/override/override8.ts(6,17): error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. -tests/cases/conformance/override/override8.ts(18,17): error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'BB'. -tests/cases/conformance/override/override8.ts(24,12): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'BB'. +tests/cases/conformance/override/override8.ts(6,17): error TS4115: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. +tests/cases/conformance/override/override8.ts(18,17): error TS4115: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'BB'. +tests/cases/conformance/override/override8.ts(24,12): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'BB'. ==== tests/cases/conformance/override/override8.ts (3 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/override/override8.ts(24,12): error TS4113: This member class D extends B { constructor(public a: string, public b: string) { ~~~~~~~~~~~~~~~~ -!!! error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. +!!! error TS4115: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'B'. super(); } } @@ -25,7 +25,7 @@ tests/cases/conformance/override/override8.ts(24,12): error TS4113: This member class DD extends BB { constructor(public a: string) { ~~~~~~~~~~~~~~~~ -!!! error TS4114: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'BB'. +!!! error TS4115: This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class 'BB'. super(a) } } @@ -33,7 +33,7 @@ tests/cases/conformance/override/override8.ts(24,12): error TS4113: This member class DDD extends BB { public a: string; ~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'BB'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'BB'. constructor(a: string) { super(a) diff --git a/tests/baselines/reference/overrideWithoutNoImplicitOverride1.errors.txt b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.errors.txt index 6b48fd7ca48d9..f548562202519 100644 --- a/tests/baselines/reference/overrideWithoutNoImplicitOverride1.errors.txt +++ b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.errors.txt @@ -1,21 +1,21 @@ -tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(2,14): error TS4111: This member cannot have an 'override' modifier because its containing class 'AmbientClass' does not extend another class. -tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(6,14): error TS4111: This member cannot have an 'override' modifier because its containing class 'NonAmbientClass' does not extend another class. -tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(18,14): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. -tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(31,18): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. -tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(44,14): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'NonAmbientBase'. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(2,14): error TS4112: This member cannot have an 'override' modifier because its containing class 'AmbientClass' does not extend another class. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(6,14): error TS4112: This member cannot have an 'override' modifier because its containing class 'NonAmbientClass' does not extend another class. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(18,14): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(31,18): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. +tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(44,14): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'NonAmbientBase'. ==== tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts (5 errors) ==== export declare class AmbientClass { override yadda(): void; ~~~~~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'AmbientClass' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'AmbientClass' does not extend another class. } export class NonAmbientClass { override yadda(): void {} ~~~~~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'NonAmbientClass' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'NonAmbientClass' does not extend another class. } ///// @@ -29,7 +29,7 @@ tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(44,14): e override bar(): void; ~~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. } ///// @@ -44,7 +44,7 @@ tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(44,14): e override bar(): void; ~~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'AmbientBase'. } } @@ -59,6 +59,6 @@ tests/cases/conformance/override/overrideWithoutNoImplicitOverride1.ts(44,14): e override bar(): void {} ~~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'NonAmbientBase'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'NonAmbientBase'. } \ No newline at end of file From feb90939a25e916d02181d2e81e4eeb7478c500b Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 5 Nov 2020 23:16:03 +0800 Subject: [PATCH 50/61] Omit override in d.ts --- src/compiler/transformers/declarations.ts | 2 +- tests/baselines/reference/override1.js | 10 ++++---- tests/baselines/reference/override10.js | 2 +- tests/baselines/reference/override2.js | 6 ++--- tests/baselines/reference/override3.js | 12 +++++----- tests/baselines/reference/override4.js | 8 +++---- tests/baselines/reference/override5.js | 26 ++++++++++----------- tests/baselines/reference/override7.js | 28 +++++++++++------------ tests/baselines/reference/override9.js | 4 ++-- 9 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 43539cb06ad71..278a7a1a9eae4 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1528,7 +1528,7 @@ namespace ts { } function ensureModifierFlags(node: Node): ModifierFlags { - let mask = ModifierFlags.All ^ (ModifierFlags.Public | ModifierFlags.Async); // No async modifiers in declaration files + let mask = ModifierFlags.All ^ (ModifierFlags.Public | ModifierFlags.Async | ModifierFlags.Override); // No async and override modifiers in declaration files let additions = (needsDeclare && !isAlwaysType(node)) ? ModifierFlags.Ambient : ModifierFlags.None; const parentIsFile = node.parent.kind === SyntaxKind.SourceFile; if (!parentIsFile || (isBundledEmit && parentIsFile && isExternalModule(node.parent as SourceFile))) { diff --git a/tests/baselines/reference/override1.js b/tests/baselines/reference/override1.js index a33e048984f8a..cf51e4cd0c8fa 100644 --- a/tests/baselines/reference/override1.js +++ b/tests/baselines/reference/override1.js @@ -126,12 +126,12 @@ declare class B { fooo(v: string): void; } declare class D extends B { - override foo(v: string): void; + foo(v: string): void; fooo(v: string): void; - override bar(v: string): void; + bar(v: string): void; } declare class C { - override foo(v: string): void; + foo(v: string): void; } declare function f(): { new (): { @@ -147,10 +147,10 @@ declare const E_base: { }; }; declare class E extends E_base { - override foo(): void; + foo(): void; bar(): void; baz(): void; - override bazz(): void; + bazz(): void; } declare function ff(): { new (): { diff --git a/tests/baselines/reference/override10.js b/tests/baselines/reference/override10.js index 555725c86422b..add4eb3e8e43f 100644 --- a/tests/baselines/reference/override10.js +++ b/tests/baselines/reference/override10.js @@ -46,6 +46,6 @@ declare abstract class Base { abstract bar(): void; } declare abstract class Sub extends Base { - override abstract foo(): number; + abstract foo(): number; bar(): void; } diff --git a/tests/baselines/reference/override2.js b/tests/baselines/reference/override2.js index a2940f3ed7be9..e7888b4efeebb 100644 --- a/tests/baselines/reference/override2.js +++ b/tests/baselines/reference/override2.js @@ -92,12 +92,12 @@ declare abstract class AD2 extends AB { abstract foo(v: ''): void; } declare abstract class AD3 extends AB { - override foo(v: ''): void; + foo(v: ''): void; abstract bar(): void; baz(): void; } declare class D4 extends AB { - override foo(v: ''): void; - override bar(v: ''): void; + foo(v: ''): void; + bar(v: ''): void; baz(): void; } diff --git a/tests/baselines/reference/override3.js b/tests/baselines/reference/override3.js index e392164f5b935..48c56009dd7fb 100644 --- a/tests/baselines/reference/override3.js +++ b/tests/baselines/reference/override3.js @@ -75,17 +75,17 @@ declare class B { } declare class D extends B { foo(): void; - override bar(): void; + bar(): void; } declare class DB extends B { - override foo(): void; - override bar(): void; + foo(): void; + bar(): void; } declare class DD extends D { - override foo(): void; - override bar(): void; + foo(): void; + bar(): void; } declare class EB extends D { foo(): void; - override bar(): void; + bar(): void; } diff --git a/tests/baselines/reference/override4.js b/tests/baselines/reference/override4.js index ccb8726c82106..77017a90f29e0 100644 --- a/tests/baselines/reference/override4.js +++ b/tests/baselines/reference/override4.js @@ -79,13 +79,13 @@ declare class B { } declare class D extends B { p1: number; - override p2: number; + p2: number; p3: () => void; - override p4: () => void; - override foo(v: string): void; + p4: () => void; + foo(v: string): void; fooo(v: string): void; } declare class DD extends B { - override foo: () => void; + foo: () => void; fooo: () => void; } diff --git a/tests/baselines/reference/override5.js b/tests/baselines/reference/override5.js index 13f64cbcae86e..2f20e1e70fed8 100644 --- a/tests/baselines/reference/override5.js +++ b/tests/baselines/reference/override5.js @@ -128,28 +128,28 @@ declare class B { } declare class D extends B { p1: number; - override p2: number; - readonly override p3: number; - override readonly p4: number; - override static sp: number; - override override oop: number; - override pp: number; - override op: number; - override constructor(); + p2: number; + readonly p3: number; + readonly p4: number; + static sp: number; + oop: number; + pp: number; + op: number; + constructor(); } declare abstract class AB { abstract f(): void; abstract b(): void; } declare abstract class AD extends AB { - override abstract f(): void; - abstract override b(): void; + abstract f(): void; + abstract b(): void; } declare abstract class AND { - override abstract f(): void; - abstract override b(): void; + abstract f(): void; + abstract b(): void; } declare class ADD extends AD { f(): void; - override b(): void; + b(): void; } diff --git a/tests/baselines/reference/override7.js b/tests/baselines/reference/override7.js index 43184eff156a1..3d22fd630e95f 100644 --- a/tests/baselines/reference/override7.js +++ b/tests/baselines/reference/override7.js @@ -122,28 +122,28 @@ declare class B { } declare class D extends B { p1: number; - override p2: number; - readonly override p3: number; - override readonly p4: number; - override static sp: number; - override override oop: number; - override pp: number; - override op: number; - override constructor(); + p2: number; + readonly p3: number; + readonly p4: number; + static sp: number; + oop: number; + pp: number; + op: number; + constructor(); } declare abstract class AB { abstract f(): void; abstract b(): void; } declare abstract class AD extends AB { - override abstract f(): void; - abstract override b(): void; + abstract f(): void; + abstract b(): void; } declare abstract class AND { - override abstract f(): void; - abstract override b(): void; + abstract f(): void; + abstract b(): void; } declare class ADD extends AD { - override f(): void; - override b(): void; + f(): void; + b(): void; } diff --git a/tests/baselines/reference/override9.js b/tests/baselines/reference/override9.js index 8f109906f6bf9..254125d798ebf 100644 --- a/tests/baselines/reference/override9.js +++ b/tests/baselines/reference/override9.js @@ -22,7 +22,7 @@ interface B { } interface D extends B { foo(): void; - override bar(): void; + bar(): void; baz(): void; - override bazz(): void; + bazz(): void; } From 0c09a2e166f9281f4e31b15e495dd825018caa27 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 5 Nov 2020 23:37:11 +0800 Subject: [PATCH 51/61] Add more case in js --- src/compiler/program.ts | 1 + .../baselines/reference/override_js1.symbols | 48 +++++++++++++++++++ tests/baselines/reference/override_js1.types | 48 +++++++++++++++++++ .../reference/override_js2.errors.txt | 35 ++++++++++++++ .../baselines/reference/override_js2.symbols | 48 +++++++++++++++++++ tests/baselines/reference/override_js2.types | 48 +++++++++++++++++++ .../reference/override_js3.errors.txt | 17 +++++++ .../baselines/reference/override_js3.symbols | 27 +++++++++++ tests/baselines/reference/override_js3.types | 27 +++++++++++ .../conformance/override/override_js1.ts | 25 ++++++++++ .../conformance/override/override_js2.ts | 26 ++++++++++ .../conformance/override/override_js3.ts | 16 +++++++ 12 files changed, 366 insertions(+) create mode 100644 tests/baselines/reference/override_js1.symbols create mode 100644 tests/baselines/reference/override_js1.types create mode 100644 tests/baselines/reference/override_js2.errors.txt create mode 100644 tests/baselines/reference/override_js2.symbols create mode 100644 tests/baselines/reference/override_js2.types create mode 100644 tests/baselines/reference/override_js3.errors.txt create mode 100644 tests/baselines/reference/override_js3.symbols create mode 100644 tests/baselines/reference/override_js3.types create mode 100644 tests/cases/conformance/override/override_js1.ts create mode 100644 tests/cases/conformance/override/override_js2.ts create mode 100644 tests/cases/conformance/override/override_js3.ts diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 16d6a6bd36715..d36ab0b5a20c9 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2096,6 +2096,7 @@ namespace ts { case SyntaxKind.ReadonlyKeyword: case SyntaxKind.DeclareKeyword: case SyntaxKind.AbstractKeyword: + case SyntaxKind.OverrideKeyword: diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind))); break; diff --git a/tests/baselines/reference/override_js1.symbols b/tests/baselines/reference/override_js1.symbols new file mode 100644 index 0000000000000..a2110ac8fcdd8 --- /dev/null +++ b/tests/baselines/reference/override_js1.symbols @@ -0,0 +1,48 @@ +=== tests/cases/conformance/override/a.js === +class B { +>B : Symbol(B, Decl(a.js, 0, 0)) + + foo (v) {} +>foo : Symbol(B.foo, Decl(a.js, 0, 9)) +>v : Symbol(v, Decl(a.js, 1, 9)) + + fooo (v) {} +>fooo : Symbol(B.fooo, Decl(a.js, 1, 14)) +>v : Symbol(v, Decl(a.js, 2, 10)) +} + +class D extends B { +>D : Symbol(D, Decl(a.js, 3, 1)) +>B : Symbol(B, Decl(a.js, 0, 0)) + + foo (v) {} +>foo : Symbol(D.foo, Decl(a.js, 5, 19)) +>v : Symbol(v, Decl(a.js, 6, 9)) + + /** @override */ + fooo (v) {} +>fooo : Symbol(D.fooo, Decl(a.js, 6, 14)) +>v : Symbol(v, Decl(a.js, 8, 10)) + + /** @override */ + bar(v) {} +>bar : Symbol(D.bar, Decl(a.js, 8, 15)) +>v : Symbol(v, Decl(a.js, 10, 8)) +} + +class C { +>C : Symbol(C, Decl(a.js, 11, 1)) + + foo () {} +>foo : Symbol(C.foo, Decl(a.js, 13, 9)) + + /** @override */ + fooo (v) {} +>fooo : Symbol(C.fooo, Decl(a.js, 14, 13)) +>v : Symbol(v, Decl(a.js, 16, 10)) + + /** @override */ + bar(v) {} +>bar : Symbol(C.bar, Decl(a.js, 16, 15)) +>v : Symbol(v, Decl(a.js, 18, 8)) +} diff --git a/tests/baselines/reference/override_js1.types b/tests/baselines/reference/override_js1.types new file mode 100644 index 0000000000000..51c7de2e81014 --- /dev/null +++ b/tests/baselines/reference/override_js1.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/override/a.js === +class B { +>B : B + + foo (v) {} +>foo : (v: any) => void +>v : any + + fooo (v) {} +>fooo : (v: any) => void +>v : any +} + +class D extends B { +>D : D +>B : B + + foo (v) {} +>foo : (v: any) => void +>v : any + + /** @override */ + fooo (v) {} +>fooo : (v: any) => void +>v : any + + /** @override */ + bar(v) {} +>bar : (v: any) => void +>v : any +} + +class C { +>C : C + + foo () {} +>foo : () => void + + /** @override */ + fooo (v) {} +>fooo : (v: any) => void +>v : any + + /** @override */ + bar(v) {} +>bar : (v: any) => void +>v : any +} diff --git a/tests/baselines/reference/override_js2.errors.txt b/tests/baselines/reference/override_js2.errors.txt new file mode 100644 index 0000000000000..54254dbdc762f --- /dev/null +++ b/tests/baselines/reference/override_js2.errors.txt @@ -0,0 +1,35 @@ +tests/cases/conformance/override/a.js(7,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +tests/cases/conformance/override/a.js(11,5): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +tests/cases/conformance/override/a.js(17,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. +tests/cases/conformance/override/a.js(19,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. + + +==== tests/cases/conformance/override/a.js (4 errors) ==== + class B { + foo (v) {} + fooo (v) {} + } + + class D extends B { + foo (v) {} + ~~~ +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. + /** @override */ + fooo (v) {} + /** @override */ + bar(v) {} + ~~~ +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. + } + + class C { + foo () {} + /** @override */ + fooo (v) {} + ~~~~ +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. + /** @override */ + bar(v) {} + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. + } \ No newline at end of file diff --git a/tests/baselines/reference/override_js2.symbols b/tests/baselines/reference/override_js2.symbols new file mode 100644 index 0000000000000..a2110ac8fcdd8 --- /dev/null +++ b/tests/baselines/reference/override_js2.symbols @@ -0,0 +1,48 @@ +=== tests/cases/conformance/override/a.js === +class B { +>B : Symbol(B, Decl(a.js, 0, 0)) + + foo (v) {} +>foo : Symbol(B.foo, Decl(a.js, 0, 9)) +>v : Symbol(v, Decl(a.js, 1, 9)) + + fooo (v) {} +>fooo : Symbol(B.fooo, Decl(a.js, 1, 14)) +>v : Symbol(v, Decl(a.js, 2, 10)) +} + +class D extends B { +>D : Symbol(D, Decl(a.js, 3, 1)) +>B : Symbol(B, Decl(a.js, 0, 0)) + + foo (v) {} +>foo : Symbol(D.foo, Decl(a.js, 5, 19)) +>v : Symbol(v, Decl(a.js, 6, 9)) + + /** @override */ + fooo (v) {} +>fooo : Symbol(D.fooo, Decl(a.js, 6, 14)) +>v : Symbol(v, Decl(a.js, 8, 10)) + + /** @override */ + bar(v) {} +>bar : Symbol(D.bar, Decl(a.js, 8, 15)) +>v : Symbol(v, Decl(a.js, 10, 8)) +} + +class C { +>C : Symbol(C, Decl(a.js, 11, 1)) + + foo () {} +>foo : Symbol(C.foo, Decl(a.js, 13, 9)) + + /** @override */ + fooo (v) {} +>fooo : Symbol(C.fooo, Decl(a.js, 14, 13)) +>v : Symbol(v, Decl(a.js, 16, 10)) + + /** @override */ + bar(v) {} +>bar : Symbol(C.bar, Decl(a.js, 16, 15)) +>v : Symbol(v, Decl(a.js, 18, 8)) +} diff --git a/tests/baselines/reference/override_js2.types b/tests/baselines/reference/override_js2.types new file mode 100644 index 0000000000000..51c7de2e81014 --- /dev/null +++ b/tests/baselines/reference/override_js2.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/override/a.js === +class B { +>B : B + + foo (v) {} +>foo : (v: any) => void +>v : any + + fooo (v) {} +>fooo : (v: any) => void +>v : any +} + +class D extends B { +>D : D +>B : B + + foo (v) {} +>foo : (v: any) => void +>v : any + + /** @override */ + fooo (v) {} +>fooo : (v: any) => void +>v : any + + /** @override */ + bar(v) {} +>bar : (v: any) => void +>v : any +} + +class C { +>C : C + + foo () {} +>foo : () => void + + /** @override */ + fooo (v) {} +>fooo : (v: any) => void +>v : any + + /** @override */ + bar(v) {} +>bar : (v: any) => void +>v : any +} diff --git a/tests/baselines/reference/override_js3.errors.txt b/tests/baselines/reference/override_js3.errors.txt new file mode 100644 index 0000000000000..02bdbe3a3e80e --- /dev/null +++ b/tests/baselines/reference/override_js3.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/override/a.js(7,5): error TS8009: The 'override' modifier can only be used in TypeScript files. + + +==== tests/cases/conformance/override/a.js (1 errors) ==== + class B { + foo (v) {} + fooo (v) {} + } + + class D extends B { + override foo (v) {} + ~~~~~~~~ +!!! error TS8009: The 'override' modifier can only be used in TypeScript files. + /** @override */ + fooo (v) {} + } + \ No newline at end of file diff --git a/tests/baselines/reference/override_js3.symbols b/tests/baselines/reference/override_js3.symbols new file mode 100644 index 0000000000000..c0f89948a14ea --- /dev/null +++ b/tests/baselines/reference/override_js3.symbols @@ -0,0 +1,27 @@ +=== tests/cases/conformance/override/a.js === +class B { +>B : Symbol(B, Decl(a.js, 0, 0)) + + foo (v) {} +>foo : Symbol(B.foo, Decl(a.js, 0, 9)) +>v : Symbol(v, Decl(a.js, 1, 9)) + + fooo (v) {} +>fooo : Symbol(B.fooo, Decl(a.js, 1, 14)) +>v : Symbol(v, Decl(a.js, 2, 10)) +} + +class D extends B { +>D : Symbol(D, Decl(a.js, 3, 1)) +>B : Symbol(B, Decl(a.js, 0, 0)) + + override foo (v) {} +>foo : Symbol(D.foo, Decl(a.js, 5, 19)) +>v : Symbol(v, Decl(a.js, 6, 18)) + + /** @override */ + fooo (v) {} +>fooo : Symbol(D.fooo, Decl(a.js, 6, 23)) +>v : Symbol(v, Decl(a.js, 8, 10)) +} + diff --git a/tests/baselines/reference/override_js3.types b/tests/baselines/reference/override_js3.types new file mode 100644 index 0000000000000..40cdf389c6e37 --- /dev/null +++ b/tests/baselines/reference/override_js3.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/override/a.js === +class B { +>B : B + + foo (v) {} +>foo : (v: any) => void +>v : any + + fooo (v) {} +>fooo : (v: any) => void +>v : any +} + +class D extends B { +>D : D +>B : B + + override foo (v) {} +>foo : (v: any) => void +>v : any + + /** @override */ + fooo (v) {} +>fooo : (v: any) => void +>v : any +} + diff --git a/tests/cases/conformance/override/override_js1.ts b/tests/cases/conformance/override/override_js1.ts new file mode 100644 index 0000000000000..75df72695e012 --- /dev/null +++ b/tests/cases/conformance/override/override_js1.ts @@ -0,0 +1,25 @@ +// @noImplicitOverride: true +// @allowJs: true +// @noEmit: true +// @Filename: a.js + +class B { + foo (v) {} + fooo (v) {} +} + +class D extends B { + foo (v) {} + /** @override */ + fooo (v) {} + /** @override */ + bar(v) {} +} + +class C { + foo () {} + /** @override */ + fooo (v) {} + /** @override */ + bar(v) {} +} \ No newline at end of file diff --git a/tests/cases/conformance/override/override_js2.ts b/tests/cases/conformance/override/override_js2.ts new file mode 100644 index 0000000000000..2de6b1662712e --- /dev/null +++ b/tests/cases/conformance/override/override_js2.ts @@ -0,0 +1,26 @@ +// @noImplicitOverride: true +// @allowJs: true +// @checkJs: true +// @noEmit: true +// @Filename: a.js + +class B { + foo (v) {} + fooo (v) {} +} + +class D extends B { + foo (v) {} + /** @override */ + fooo (v) {} + /** @override */ + bar(v) {} +} + +class C { + foo () {} + /** @override */ + fooo (v) {} + /** @override */ + bar(v) {} +} \ No newline at end of file diff --git a/tests/cases/conformance/override/override_js3.ts b/tests/cases/conformance/override/override_js3.ts new file mode 100644 index 0000000000000..f36a29e37796d --- /dev/null +++ b/tests/cases/conformance/override/override_js3.ts @@ -0,0 +1,16 @@ +// @noImplicitOverride: true +// @allowJs: true +// @checkJs: true +// @noEmit: true +// @Filename: a.js + +class B { + foo (v) {} + fooo (v) {} +} + +class D extends B { + override foo (v) {} + /** @override */ + fooo (v) {} +} From 3cf3c2887d4a0b88e71ec05ce40ac05a348817dc Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 5 Nov 2020 23:39:09 +0800 Subject: [PATCH 52/61] Accept baseline --- .../baselines/reference/jsdocOverrideTag1.errors.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/baselines/reference/jsdocOverrideTag1.errors.txt b/tests/baselines/reference/jsdocOverrideTag1.errors.txt index 482732ca41946..3bc565a1744bc 100644 --- a/tests/baselines/reference/jsdocOverrideTag1.errors.txt +++ b/tests/baselines/reference/jsdocOverrideTag1.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/jsdoc/0.js(27,5): error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'A'. -tests/cases/conformance/jsdoc/0.js(32,5): error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. -tests/cases/conformance/jsdoc/0.js(40,5): error TS4111: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. +tests/cases/conformance/jsdoc/0.js(27,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'A'. +tests/cases/conformance/jsdoc/0.js(32,5): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. +tests/cases/conformance/jsdoc/0.js(40,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. ==== tests/cases/conformance/jsdoc/0.js (3 errors) ==== @@ -32,14 +32,14 @@ tests/cases/conformance/jsdoc/0.js(40,5): error TS4111: This member cannot have bar () { ~~~ -!!! error TS4113: This member must have an 'override' modifier because it overrides a member in the base class 'A'. +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'A'. } /** @override */ baz () { ~~~ -!!! error TS4112: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. } } @@ -49,7 +49,7 @@ tests/cases/conformance/jsdoc/0.js(40,5): error TS4111: This member cannot have /** @override */ foo () { ~~~ -!!! error TS4111: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. } } \ No newline at end of file From d874ae884bb8ced004d7b52b27bc85b48b6321a4 Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 6 Nov 2020 11:47:03 +0800 Subject: [PATCH 53/61] fix override js test --- tests/cases/fourslash/codeFixOverrideModifier_js1.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cases/fourslash/codeFixOverrideModifier_js1.ts b/tests/cases/fourslash/codeFixOverrideModifier_js1.ts index bc26610ae6d14..dd5675266572a 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier_js1.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier_js1.ts @@ -18,5 +18,5 @@ //// foo () {} //// } -verify.not.codeFixAvailable("Add 'override' modifier"); -verify.not.codeFixAvailable("Remove 'override' modifier"); +verify.not.codeFixAvailable("fixAddOverrideModifier"); +verify.not.codeFixAvailable("fixRemoveOverrideModifier"); From f9384bc54b2b9a212af4a937394923b21f2297a4 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 7 Jan 2021 17:32:14 +0800 Subject: [PATCH 54/61] fix crlf --- src/compiler/diagnosticMessages.json | 12674 ++++++++++++------------- 1 file changed, 6337 insertions(+), 6337 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index aa5518d72b9b4..05ac1a0d66338 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1,6337 +1,6337 @@ -{ - "Unterminated string literal.": { - "category": "Error", - "code": 1002 - }, - "Identifier expected.": { - "category": "Error", - "code": 1003 - }, - "'{0}' expected.": { - "category": "Error", - "code": 1005 - }, - "A file cannot have a reference to itself.": { - "category": "Error", - "code": 1006 - }, - "The parser expected to find a '}' to match the '{' token here.": { - "category": "Error", - "code": 1007 - }, - "Trailing comma not allowed.": { - "category": "Error", - "code": 1009 - }, - "'*/' expected.": { - "category": "Error", - "code": 1010 - }, - "An element access expression should take an argument.": { - "category": "Error", - "code": 1011 - }, - "Unexpected token.": { - "category": "Error", - "code": 1012 - }, - "A rest parameter or binding pattern may not have a trailing comma.": { - "category": "Error", - "code": 1013 - }, - "A rest parameter must be last in a parameter list.": { - "category": "Error", - "code": 1014 - }, - "Parameter cannot have question mark and initializer.": { - "category": "Error", - "code": 1015 - }, - "A required parameter cannot follow an optional parameter.": { - "category": "Error", - "code": 1016 - }, - "An index signature cannot have a rest parameter.": { - "category": "Error", - "code": 1017 - }, - "An index signature parameter cannot have an accessibility modifier.": { - "category": "Error", - "code": 1018 - }, - "An index signature parameter cannot have a question mark.": { - "category": "Error", - "code": 1019 - }, - "An index signature parameter cannot have an initializer.": { - "category": "Error", - "code": 1020 - }, - "An index signature must have a type annotation.": { - "category": "Error", - "code": 1021 - }, - "An index signature parameter must have a type annotation.": { - "category": "Error", - "code": 1022 - }, - "An index signature parameter type must be either 'string' or 'number'.": { - "category": "Error", - "code": 1023 - }, - "'readonly' modifier can only appear on a property declaration or index signature.": { - "category": "Error", - "code": 1024 - }, - "An index signature cannot have a trailing comma.": { - "category": "Error", - "code": 1025 - }, - "Accessibility modifier already seen.": { - "category": "Error", - "code": 1028 - }, - "'{0}' modifier must precede '{1}' modifier.": { - "category": "Error", - "code": 1029 - }, - "'{0}' modifier already seen.": { - "category": "Error", - "code": 1030 - }, - "'{0}' modifier cannot appear on class elements of this kind.": { - "category": "Error", - "code": 1031 - }, - "'super' must be followed by an argument list or member access.": { - "category": "Error", - "code": 1034 - }, - "Only ambient modules can use quoted names.": { - "category": "Error", - "code": 1035 - }, - "Statements are not allowed in ambient contexts.": { - "category": "Error", - "code": 1036 - }, - "A 'declare' modifier cannot be used in an already ambient context.": { - "category": "Error", - "code": 1038 - }, - "Initializers are not allowed in ambient contexts.": { - "category": "Error", - "code": 1039 - }, - "'{0}' modifier cannot be used in an ambient context.": { - "category": "Error", - "code": 1040 - }, - "'{0}' modifier cannot be used with a class declaration.": { - "category": "Error", - "code": 1041 - }, - "'{0}' modifier cannot be used here.": { - "category": "Error", - "code": 1042 - }, - "'{0}' modifier cannot appear on a data property.": { - "category": "Error", - "code": 1043 - }, - "'{0}' modifier cannot appear on a module or namespace element.": { - "category": "Error", - "code": 1044 - }, - "A '{0}' modifier cannot be used with an interface declaration.": { - "category": "Error", - "code": 1045 - }, - "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.": { - "category": "Error", - "code": 1046 - }, - "A rest parameter cannot be optional.": { - "category": "Error", - "code": 1047 - }, - "A rest parameter cannot have an initializer.": { - "category": "Error", - "code": 1048 - }, - "A 'set' accessor must have exactly one parameter.": { - "category": "Error", - "code": 1049 - }, - "A 'set' accessor cannot have an optional parameter.": { - "category": "Error", - "code": 1051 - }, - "A 'set' accessor parameter cannot have an initializer.": { - "category": "Error", - "code": 1052 - }, - "A 'set' accessor cannot have rest parameter.": { - "category": "Error", - "code": 1053 - }, - "A 'get' accessor cannot have parameters.": { - "category": "Error", - "code": 1054 - }, - "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.": { - "category": "Error", - "code": 1055 - }, - "Accessors are only available when targeting ECMAScript 5 and higher.": { - "category": "Error", - "code": 1056 - }, - "An async function or method must have a valid awaitable return type.": { - "category": "Error", - "code": 1057 - }, - "The return type of an async function must either be a valid promise or must not contain a callable 'then' member.": { - "category": "Error", - "code": 1058 - }, - "A promise must have a 'then' method.": { - "category": "Error", - "code": 1059 - }, - "The first parameter of the 'then' method of a promise must be a callback.": { - "category": "Error", - "code": 1060 - }, - "Enum member must have initializer.": { - "category": "Error", - "code": 1061 - }, - "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method.": { - "category": "Error", - "code": 1062 - }, - "An export assignment cannot be used in a namespace.": { - "category": "Error", - "code": 1063 - }, - "The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise<{0}>'?": { - "category": "Error", - "code": 1064 - }, - "In ambient enum declarations member initializer must be constant expression.": { - "category": "Error", - "code": 1066 - }, - "Unexpected token. A constructor, method, accessor, or property was expected.": { - "category": "Error", - "code": 1068 - }, - "Unexpected token. A type parameter name was expected without curly braces.": { - "category": "Error", - "code": 1069 - }, - "'{0}' modifier cannot appear on a type member.": { - "category": "Error", - "code": 1070 - }, - "'{0}' modifier cannot appear on an index signature.": { - "category": "Error", - "code": 1071 - }, - "A '{0}' modifier cannot be used with an import declaration.": { - "category": "Error", - "code": 1079 - }, - "Invalid 'reference' directive syntax.": { - "category": "Error", - "code": 1084 - }, - "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'.": { - "category": "Error", - "code": 1085 - }, - "'{0}' modifier cannot appear on a constructor declaration.": { - "category": "Error", - "code": 1089 - }, - "'{0}' modifier cannot appear on a parameter.": { - "category": "Error", - "code": 1090 - }, - "Only a single variable declaration is allowed in a 'for...in' statement.": { - "category": "Error", - "code": 1091 - }, - "Type parameters cannot appear on a constructor declaration.": { - "category": "Error", - "code": 1092 - }, - "Type annotation cannot appear on a constructor declaration.": { - "category": "Error", - "code": 1093 - }, - "An accessor cannot have type parameters.": { - "category": "Error", - "code": 1094 - }, - "A 'set' accessor cannot have a return type annotation.": { - "category": "Error", - "code": 1095 - }, - "An index signature must have exactly one parameter.": { - "category": "Error", - "code": 1096 - }, - "'{0}' list cannot be empty.": { - "category": "Error", - "code": 1097 - }, - "Type parameter list cannot be empty.": { - "category": "Error", - "code": 1098 - }, - "Type argument list cannot be empty.": { - "category": "Error", - "code": 1099 - }, - "Invalid use of '{0}' in strict mode.": { - "category": "Error", - "code": 1100 - }, - "'with' statements are not allowed in strict mode.": { - "category": "Error", - "code": 1101 - }, - "'delete' cannot be called on an identifier in strict mode.": { - "category": "Error", - "code": 1102 - }, - "A 'for-await-of' statement is only allowed within an async function or async generator.": { - "category": "Error", - "code": 1103 - }, - "A 'continue' statement can only be used within an enclosing iteration statement.": { - "category": "Error", - "code": 1104 - }, - "A 'break' statement can only be used within an enclosing iteration or switch statement.": { - "category": "Error", - "code": 1105 - }, - "Jump target cannot cross function boundary.": { - "category": "Error", - "code": 1107 - }, - "A 'return' statement can only be used within a function body.": { - "category": "Error", - "code": 1108 - }, - "Expression expected.": { - "category": "Error", - "code": 1109 - }, - "Type expected.": { - "category": "Error", - "code": 1110 - }, - "A 'default' clause cannot appear more than once in a 'switch' statement.": { - "category": "Error", - "code": 1113 - }, - "Duplicate label '{0}'.": { - "category": "Error", - "code": 1114 - }, - "A 'continue' statement can only jump to a label of an enclosing iteration statement.": { - "category": "Error", - "code": 1115 - }, - "A 'break' statement can only jump to a label of an enclosing statement.": { - "category": "Error", - "code": 1116 - }, - "An object literal cannot have multiple properties with the same name in strict mode.": { - "category": "Error", - "code": 1117 - }, - "An object literal cannot have multiple get/set accessors with the same name.": { - "category": "Error", - "code": 1118 - }, - "An object literal cannot have property and accessor with the same name.": { - "category": "Error", - "code": 1119 - }, - "An export assignment cannot have modifiers.": { - "category": "Error", - "code": 1120 - }, - "Octal literals are not allowed in strict mode.": { - "category": "Error", - "code": 1121 - }, - "Variable declaration list cannot be empty.": { - "category": "Error", - "code": 1123 - }, - "Digit expected.": { - "category": "Error", - "code": 1124 - }, - "Hexadecimal digit expected.": { - "category": "Error", - "code": 1125 - }, - "Unexpected end of text.": { - "category": "Error", - "code": 1126 - }, - "Invalid character.": { - "category": "Error", - "code": 1127 - }, - "Declaration or statement expected.": { - "category": "Error", - "code": 1128 - }, - "Statement expected.": { - "category": "Error", - "code": 1129 - }, - "'case' or 'default' expected.": { - "category": "Error", - "code": 1130 - }, - "Property or signature expected.": { - "category": "Error", - "code": 1131 - }, - "Enum member expected.": { - "category": "Error", - "code": 1132 - }, - "Variable declaration expected.": { - "category": "Error", - "code": 1134 - }, - "Argument expression expected.": { - "category": "Error", - "code": 1135 - }, - "Property assignment expected.": { - "category": "Error", - "code": 1136 - }, - "Expression or comma expected.": { - "category": "Error", - "code": 1137 - }, - "Parameter declaration expected.": { - "category": "Error", - "code": 1138 - }, - "Type parameter declaration expected.": { - "category": "Error", - "code": 1139 - }, - "Type argument expected.": { - "category": "Error", - "code": 1140 - }, - "String literal expected.": { - "category": "Error", - "code": 1141 - }, - "Line break not permitted here.": { - "category": "Error", - "code": 1142 - }, - "'{' or ';' expected.": { - "category": "Error", - "code": 1144 - }, - "Declaration expected.": { - "category": "Error", - "code": 1146 - }, - "Import declarations in a namespace cannot reference a module.": { - "category": "Error", - "code": 1147 - }, - "Cannot use imports, exports, or module augmentations when '--module' is 'none'.": { - "category": "Error", - "code": 1148 - }, - "File name '{0}' differs from already included file name '{1}' only in casing.": { - "category": "Error", - "code": 1149 - }, - "'const' declarations must be initialized.": { - "category": "Error", - "code": 1155 - }, - "'const' declarations can only be declared inside a block.": { - "category": "Error", - "code": 1156 - }, - "'let' declarations can only be declared inside a block.": { - "category": "Error", - "code": 1157 - }, - "Unterminated template literal.": { - "category": "Error", - "code": 1160 - }, - "Unterminated regular expression literal.": { - "category": "Error", - "code": 1161 - }, - "An object member cannot be declared optional.": { - "category": "Error", - "code": 1162 - }, - "A 'yield' expression is only allowed in a generator body.": { - "category": "Error", - "code": 1163 - }, - "Computed property names are not allowed in enums.": { - "category": "Error", - "code": 1164 - }, - "A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.": { - "category": "Error", - "code": 1165 - }, - "A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.": { - "category": "Error", - "code": 1166 - }, - "A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.": { - "category": "Error", - "code": 1168 - }, - "A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.": { - "category": "Error", - "code": 1169 - }, - "A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.": { - "category": "Error", - "code": 1170 - }, - "A comma expression is not allowed in a computed property name.": { - "category": "Error", - "code": 1171 - }, - "'extends' clause already seen.": { - "category": "Error", - "code": 1172 - }, - "'extends' clause must precede 'implements' clause.": { - "category": "Error", - "code": 1173 - }, - "Classes can only extend a single class.": { - "category": "Error", - "code": 1174 - }, - "'implements' clause already seen.": { - "category": "Error", - "code": 1175 - }, - "Interface declaration cannot have 'implements' clause.": { - "category": "Error", - "code": 1176 - }, - "Binary digit expected.": { - "category": "Error", - "code": 1177 - }, - "Octal digit expected.": { - "category": "Error", - "code": 1178 - }, - "Unexpected token. '{' expected.": { - "category": "Error", - "code": 1179 - }, - "Property destructuring pattern expected.": { - "category": "Error", - "code": 1180 - }, - "Array element destructuring pattern expected.": { - "category": "Error", - "code": 1181 - }, - "A destructuring declaration must have an initializer.": { - "category": "Error", - "code": 1182 - }, - "An implementation cannot be declared in ambient contexts.": { - "category": "Error", - "code": 1183 - }, - "Modifiers cannot appear here.": { - "category": "Error", - "code": 1184 - }, - "Merge conflict marker encountered.": { - "category": "Error", - "code": 1185 - }, - "A rest element cannot have an initializer.": { - "category": "Error", - "code": 1186 - }, - "A parameter property may not be declared using a binding pattern.": { - "category": "Error", - "code": 1187 - }, - "Only a single variable declaration is allowed in a 'for...of' statement.": { - "category": "Error", - "code": 1188 - }, - "The variable declaration of a 'for...in' statement cannot have an initializer.": { - "category": "Error", - "code": 1189 - }, - "The variable declaration of a 'for...of' statement cannot have an initializer.": { - "category": "Error", - "code": 1190 - }, - "An import declaration cannot have modifiers.": { - "category": "Error", - "code": 1191 - }, - "Module '{0}' has no default export.": { - "category": "Error", - "code": 1192 - }, - "An export declaration cannot have modifiers.": { - "category": "Error", - "code": 1193 - }, - "Export declarations are not permitted in a namespace.": { - "category": "Error", - "code": 1194 - }, - "'export *' does not re-export a default.": { - "category": "Error", - "code": 1195 - }, - "Catch clause variable type annotation must be 'any' or 'unknown' if specified.": { - "category": "Error", - "code": 1196 - }, - "Catch clause variable cannot have an initializer.": { - "category": "Error", - "code": 1197 - }, - "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.": { - "category": "Error", - "code": 1198 - }, - "Unterminated Unicode escape sequence.": { - "category": "Error", - "code": 1199 - }, - "Line terminator not permitted before arrow.": { - "category": "Error", - "code": 1200 - }, - "Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.": { - "category": "Error", - "code": 1202 - }, - "Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.": { - "category": "Error", - "code": 1203 - }, - "Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.": { - "category": "Error", - "code": 1205 - }, - "Decorators are not valid here.": { - "category": "Error", - "code": 1206 - }, - "Decorators cannot be applied to multiple get/set accessors of the same name.": { - "category": "Error", - "code": 1207 - }, - "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module.": { - "category": "Error", - "code": 1208 - }, - "Invalid use of '{0}'. Class definitions are automatically in strict mode.": { - "category": "Error", - "code": 1210 - }, - "A class declaration without the 'default' modifier must have a name.": { - "category": "Error", - "code": 1211 - }, - "Identifier expected. '{0}' is a reserved word in strict mode.": { - "category": "Error", - "code": 1212 - }, - "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.": { - "category": "Error", - "code": 1213 - }, - "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode.": { - "category": "Error", - "code": 1214 - }, - "Invalid use of '{0}'. Modules are automatically in strict mode.": { - "category": "Error", - "code": 1215 - }, - "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules.": { - "category": "Error", - "code": 1216 - }, - "Export assignment is not supported when '--module' flag is 'system'.": { - "category": "Error", - "code": 1218 - }, - "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.": { - "category": "Error", - "code": 1219 - }, - "Generators are only available when targeting ECMAScript 2015 or higher.": { - "category": "Error", - "code": 1220 - }, - "Generators are not allowed in an ambient context.": { - "category": "Error", - "code": 1221 - }, - "An overload signature cannot be declared as a generator.": { - "category": "Error", - "code": 1222 - }, - "'{0}' tag already specified.": { - "category": "Error", - "code": 1223 - }, - "Signature '{0}' must be a type predicate.": { - "category": "Error", - "code": 1224 - }, - "Cannot find parameter '{0}'.": { - "category": "Error", - "code": 1225 - }, - "Type predicate '{0}' is not assignable to '{1}'.": { - "category": "Error", - "code": 1226 - }, - "Parameter '{0}' is not in the same position as parameter '{1}'.": { - "category": "Error", - "code": 1227 - }, - "A type predicate is only allowed in return type position for functions and methods.": { - "category": "Error", - "code": 1228 - }, - "A type predicate cannot reference a rest parameter.": { - "category": "Error", - "code": 1229 - }, - "A type predicate cannot reference element '{0}' in a binding pattern.": { - "category": "Error", - "code": 1230 - }, - "An export assignment can only be used in a module.": { - "category": "Error", - "code": 1231 - }, - "An import declaration can only be used in a namespace or module.": { - "category": "Error", - "code": 1232 - }, - "An export declaration can only be used in a module.": { - "category": "Error", - "code": 1233 - }, - "An ambient module declaration is only allowed at the top level in a file.": { - "category": "Error", - "code": 1234 - }, - "A namespace declaration is only allowed in a namespace or module.": { - "category": "Error", - "code": 1235 - }, - "The return type of a property decorator function must be either 'void' or 'any'.": { - "category": "Error", - "code": 1236 - }, - "The return type of a parameter decorator function must be either 'void' or 'any'.": { - "category": "Error", - "code": 1237 - }, - "Unable to resolve signature of class decorator when called as an expression.": { - "category": "Error", - "code": 1238 - }, - "Unable to resolve signature of parameter decorator when called as an expression.": { - "category": "Error", - "code": 1239 - }, - "Unable to resolve signature of property decorator when called as an expression.": { - "category": "Error", - "code": 1240 - }, - "Unable to resolve signature of method decorator when called as an expression.": { - "category": "Error", - "code": 1241 - }, - "'abstract' modifier can only appear on a class, method, or property declaration.": { - "category": "Error", - "code": 1242 - }, - "'{0}' modifier cannot be used with '{1}' modifier.": { - "category": "Error", - "code": 1243 - }, - "Abstract methods can only appear within an abstract class.": { - "category": "Error", - "code": 1244 - }, - "Method '{0}' cannot have an implementation because it is marked abstract.": { - "category": "Error", - "code": 1245 - }, - "An interface property cannot have an initializer.": { - "category": "Error", - "code": 1246 - }, - "A type literal property cannot have an initializer.": { - "category": "Error", - "code": 1247 - }, - "A class member cannot have the '{0}' keyword.": { - "category": "Error", - "code": 1248 - }, - "A decorator can only decorate a method implementation, not an overload.": { - "category": "Error", - "code": 1249 - }, - "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.": { - "category": "Error", - "code": 1250 - }, - "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.": { - "category": "Error", - "code": 1251 - }, - "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.": { - "category": "Error", - "code": 1252 - }, - "'{0}' tag cannot be used independently as a top level JSDoc tag.": { - "category": "Error", - "code": 1253 - }, - "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.": { - "category": "Error", - "code": 1254 - }, - "A definite assignment assertion '!' is not permitted in this context.": { - "category": "Error", - "code": 1255 - }, - "A rest element must be last in a tuple type.": { - "category": "Error", - "code": 1256 - }, - "A required element cannot follow an optional element.": { - "category": "Error", - "code": 1257 - }, - "Module '{0}' can only be default-imported using the '{1}' flag": { - "category": "Error", - "code": 1259 - }, - "Keywords cannot contain escape characters.": { - "category": "Error", - "code": 1260 - }, - "Already included file name '{0}' differs from file name '{1}' only in casing.": { - "category": "Error", - "code": 1261 - }, - "Identifier expected. '{0}' is a reserved word at the top-level of a module.": { - "category": "Error", - "code": 1262 - }, - "Declarations with initializers cannot also have definite assignment assertions.": { - "category": "Error", - "code": 1263 - }, - "Declarations with definite assignment assertions must also have type annotations.": { - "category": "Error", - "code": 1264 - }, - - "'with' statements are not allowed in an async function block.": { - "category": "Error", - "code": 1300 - }, - "'await' expressions are only allowed within async functions and at the top levels of modules.": { - "category": "Error", - "code": 1308 - }, - "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern.": { - "category": "Error", - "code": 1312 - }, - "The body of an 'if' statement cannot be the empty statement.": { - "category": "Error", - "code": 1313 - }, - "Global module exports may only appear in module files.": { - "category": "Error", - "code": 1314 - }, - "Global module exports may only appear in declaration files.": { - "category": "Error", - "code": 1315 - }, - "Global module exports may only appear at top level.": { - "category": "Error", - "code": 1316 - }, - "A parameter property cannot be declared using a rest parameter.": { - "category": "Error", - "code": 1317 - }, - "An abstract accessor cannot have an implementation.": { - "category": "Error", - "code": 1318 - }, - "A default export can only be used in an ECMAScript-style module.": { - "category": "Error", - "code": 1319 - }, - "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member.": { - "category": "Error", - "code": 1320 - }, - "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member.": { - "category": "Error", - "code": 1321 - }, - "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member.": { - "category": "Error", - "code": 1322 - }, - "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": { - "category": "Error", - "code": 1323 - }, - "Dynamic import must have one specifier as an argument.": { - "category": "Error", - "code": 1324 - }, - "Specifier of dynamic import cannot be spread element.": { - "category": "Error", - "code": 1325 - }, - "Dynamic import cannot have type arguments.": { - "category": "Error", - "code": 1326 - }, - "String literal with double quotes expected.": { - "category": "Error", - "code": 1327 - }, - "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.": { - "category": "Error", - "code": 1328 - }, - "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?": { - "category": "Error", - "code": 1329 - }, - "A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.": { - "category": "Error", - "code": 1330 - }, - "A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.": { - "category": "Error", - "code": 1331 - }, - "A variable whose type is a 'unique symbol' type must be 'const'.": { - "category": "Error", - "code": 1332 - }, - "'unique symbol' types may not be used on a variable declaration with a binding name.": { - "category": "Error", - "code": 1333 - }, - "'unique symbol' types are only allowed on variables in a variable statement.": { - "category": "Error", - "code": 1334 - }, - "'unique symbol' types are not allowed here.": { - "category": "Error", - "code": 1335 - }, - "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead.": { - "category": "Error", - "code": 1336 - }, - "An index signature parameter type cannot be a union type. Consider using a mapped object type instead.": { - "category": "Error", - "code": 1337 - }, - "'infer' declarations are only permitted in the 'extends' clause of a conditional type.": { - "category": "Error", - "code": 1338 - }, - "Module '{0}' does not refer to a value, but is used as a value here.": { - "category": "Error", - "code": 1339 - }, - "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?": { - "category": "Error", - "code": 1340 - }, - "Type arguments cannot be used here.": { - "category": "Error", - "code": 1342 - }, - "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.": { - "category": "Error", - "code": 1343 - }, - "'A label is not allowed here.": { - "category": "Error", - "code": 1344 - }, - "An expression of type 'void' cannot be tested for truthiness.": { - "category": "Error", - "code": 1345 - }, - "This parameter is not allowed with 'use strict' directive.": { - "category": "Error", - "code": 1346 - }, - "'use strict' directive cannot be used with non-simple parameter list.": { - "category": "Error", - "code": 1347 - }, - "Non-simple parameter declared here.": { - "category": "Error", - "code": 1348 - }, - "'use strict' directive used here.": { - "category": "Error", - "code": 1349 - }, - "Print the final configuration instead of building.": { - "category": "Message", - "code": 1350 - }, - "An identifier or keyword cannot immediately follow a numeric literal.": { - "category": "Error", - "code": 1351 - }, - "A bigint literal cannot use exponential notation.": { - "category": "Error", - "code": 1352 - }, - "A bigint literal must be an integer.": { - "category": "Error", - "code": 1353 - }, - "'readonly' type modifier is only permitted on array and tuple literal types.": { - "category": "Error", - "code": 1354 - }, - "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.": { - "category": "Error", - "code": 1355 - }, - "Did you mean to mark this function as 'async'?": { - "category": "Error", - "code": 1356 - }, - "An enum member name must be followed by a ',', '=', or '}'.": { - "category": "Error", - "code": 1357 - }, - "Tagged template expressions are not permitted in an optional chain.": { - "category": "Error", - "code": 1358 - }, - "Identifier expected. '{0}' is a reserved word that cannot be used here.": { - "category": "Error", - "code": 1359 - }, - "Did you mean to parenthesize this function type?": { - "category": "Error", - "code": 1360 - }, - "'{0}' cannot be used as a value because it was imported using 'import type'.": { - "category": "Error", - "code": 1361 - }, - "'{0}' cannot be used as a value because it was exported using 'export type'.": { - "category": "Error", - "code": 1362 - }, - "A type-only import can specify a default import or named bindings, but not both.": { - "category": "Error", - "code": 1363 - }, - "Convert to type-only export": { - "category": "Message", - "code": 1364 - }, - "Convert all re-exported types to type-only exports": { - "category": "Message", - "code": 1365 - }, - "Split into two separate import declarations": { - "category": "Message", - "code": 1366 - }, - "Split all invalid type-only imports": { - "category": "Message", - "code": 1367 - }, - "Specify emit/checking behavior for imports that are only used for types": { - "category": "Message", - "code": 1368 - }, - "Did you mean '{0}'?": { - "category": "Message", - "code": 1369 - }, - "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.": { - "category": "Error", - "code": 1371 - }, - "Convert to type-only import": { - "category": "Message", - "code": 1373 - }, - "Convert all imports not used as a value to type-only imports": { - "category": "Message", - "code": 1374 - }, - "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.": { - "category": "Error", - "code": 1375 - }, - "'{0}' was imported here.": { - "category": "Message", - "code": 1376 - }, - "'{0}' was exported here.": { - "category": "Message", - "code": 1377 - }, - "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.": { - "category": "Error", - "code": 1378 - }, - "An import alias cannot reference a declaration that was exported using 'export type'.": { - "category": "Error", - "code": 1379 - }, - "An import alias cannot reference a declaration that was imported using 'import type'.": { - "category": "Error", - "code": 1380 - }, - "Unexpected token. Did you mean `{'}'}` or `}`?": { - "category": "Error", - "code": 1381 - }, - "Unexpected token. Did you mean `{'>'}` or `>`?": { - "category": "Error", - "code": 1382 - }, - "Only named exports may use 'export type'.": { - "category": "Error", - "code": 1383 - }, - "A 'new' expression with type arguments must always be followed by a parenthesized argument list.": { - "category": "Error", - "code": 1384 - }, - "Function type notation must be parenthesized when used in a union type.": { - "category": "Error", - "code": 1385 - }, - "Constructor type notation must be parenthesized when used in a union type.": { - "category": "Error", - "code": 1386 - }, - "Function type notation must be parenthesized when used in an intersection type.": { - "category": "Error", - "code": 1387 - }, - "Constructor type notation must be parenthesized when used in an intersection type.": { - "category": "Error", - "code": 1388 - }, - "'{0}' is not allowed as a variable declaration name.": { - "category": "Error", - "code": 1389 - }, - "Provides a root package name when using outFile with declarations.": { - "category": "Message", - "code": 1390 - }, - "The `bundledPackageName` option must be provided when using outFile and node module resolution with declaration emit.": { - "category": "Error", - "code": 1391 - }, - "An import alias cannot use 'import type'": { - "category": "Error", - "code": 1392 - }, - "Imported via {0} from file '{1}'": { - "category": "Message", - "code": 1393 - }, - "Imported via {0} from file '{1}' with packageId '{2}'": { - "category": "Message", - "code": 1394 - }, - "Imported via {0} from file '{1}' to import 'importHelpers' as specified in compilerOptions": { - "category": "Message", - "code": 1395 - }, - "Imported via {0} from file '{1}' with packageId '{2}' to import 'importHelpers' as specified in compilerOptions": { - "category": "Message", - "code": 1396 - }, - "Imported via {0} from file '{1}' to import 'jsx' and 'jsxs' factory functions": { - "category": "Message", - "code": 1397 - }, - "Imported via {0} from file '{1}' with packageId '{2}' to import 'jsx' and 'jsxs' factory functions": { - "category": "Message", - "code": 1398 - }, - "File is included via import here.": { - "category": "Message", - "code": 1399 - }, - "Referenced via '{0}' from file '{1}'": { - "category": "Message", - "code": 1400 - }, - "File is included via reference here.": { - "category": "Message", - "code": 1401 - }, - "Type library referenced via '{0}' from file '{1}'": { - "category": "Message", - "code": 1402 - }, - "Type library referenced via '{0}' from file '{1}' with packageId '{2}'": { - "category": "Message", - "code": 1403 - }, - "File is included via type library reference here.": { - "category": "Message", - "code": 1404 - }, - "Library referenced via '{0}' from file '{1}'": { - "category": "Message", - "code": 1405 - }, - "File is included via library reference here.": { - "category": "Message", - "code": 1406 - }, - "Matched by include pattern '{0}' in '{1}'": { - "category": "Message", - "code": 1407 - }, - "File is matched by include pattern specified here.": { - "category": "Message", - "code": 1408 - }, - "Part of 'files' list in tsconfig.json": { - "category": "Message", - "code": 1409 - }, - "File is matched by 'files' list specified here.": { - "category": "Message", - "code": 1410 - }, - "Output from referenced project '{0}' included because '{1}' specified": { - "category": "Message", - "code": 1411 - }, - "Output from referenced project '{0}' included because '--module' is specified as 'none'": { - "category": "Message", - "code": 1412 - }, - "File is output from referenced project specified here.": { - "category": "Message", - "code": 1413 - }, - "Source from referenced project '{0}' included because '{1}' specified": { - "category": "Message", - "code": 1414 - }, - "Source from referenced project '{0}' included because '--module' is specified as 'none'": { - "category": "Message", - "code": 1415 - }, - "File is source from referenced project specified here.": { - "category": "Message", - "code": 1416 - }, - "Entry point of type library '{0}' specified in compilerOptions": { - "category": "Message", - "code": 1417 - }, - "Entry point of type library '{0}' specified in compilerOptions with packageId '{1}'": { - "category": "Message", - "code": 1418 - }, - "File is entry point of type library specified here.": { - "category": "Message", - "code": 1419 - }, - "Entry point for implicit type library '{0}'": { - "category": "Message", - "code": 1420 - }, - "Entry point for implicit type library '{0}' with packageId '{1}'": { - "category": "Message", - "code": 1421 - }, - "Library '{0}' specified in compilerOptions": { - "category": "Message", - "code": 1422 - }, - "File is library specified here.": { - "category": "Message", - "code": 1423 - }, - "Default library": { - "category": "Message", - "code": 1424 - }, - "Default library for target '{0}'": { - "category": "Message", - "code": 1425 - }, - "File is default library for target specified here.": { - "category": "Message", - "code": 1426 - }, - "Root file specified for compilation": { - "category": "Message", - "code": 1427 - }, - "File is output of project reference source '{0}'": { - "category": "Message", - "code": 1428 - }, - "File redirects to file '{0}'": { - "category": "Message", - "code": 1429 - }, - "The file is in the program because:": { - "category": "Message", - "code": 1430 - }, - "The types of '{0}' are incompatible between these types.": { - "category": "Error", - "code": 2200 - }, - "The types returned by '{0}' are incompatible between these types.": { - "category": "Error", - "code": 2201 - }, - "Call signature return types '{0}' and '{1}' are incompatible.": { - "category": "Error", - "code": 2202, - "elidedInCompatabilityPyramid": true - }, - "Construct signature return types '{0}' and '{1}' are incompatible.": { - "category": "Error", - "code": 2203, - "elidedInCompatabilityPyramid": true - }, - "Call signatures with no arguments have incompatible return types '{0}' and '{1}'.": { - "category": "Error", - "code": 2204, - "elidedInCompatabilityPyramid": true - }, - "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.": { - "category": "Error", - "code": 2205, - "elidedInCompatabilityPyramid": true - }, - - "Duplicate identifier '{0}'.": { - "category": "Error", - "code": 2300 - }, - "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.": { - "category": "Error", - "code": 2301 - }, - "Static members cannot reference class type parameters.": { - "category": "Error", - "code": 2302 - }, - "Circular definition of import alias '{0}'.": { - "category": "Error", - "code": 2303 - }, - "Cannot find name '{0}'.": { - "category": "Error", - "code": 2304 - }, - "Module '{0}' has no exported member '{1}'.": { - "category": "Error", - "code": 2305 - }, - "File '{0}' is not a module.": { - "category": "Error", - "code": 2306 - }, - "Cannot find module '{0}' or its corresponding type declarations.": { - "category": "Error", - "code": 2307 - }, - "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity.": { - "category": "Error", - "code": 2308 - }, - "An export assignment cannot be used in a module with other exported elements.": { - "category": "Error", - "code": 2309 - }, - "Type '{0}' recursively references itself as a base type.": { - "category": "Error", - "code": 2310 - }, - "A class may only extend another class.": { - "category": "Error", - "code": 2311 - }, - "An interface can only extend an object type or intersection of object types with statically known members.": { - "category": "Error", - "code": 2312 - }, - "Type parameter '{0}' has a circular constraint.": { - "category": "Error", - "code": 2313 - }, - "Generic type '{0}' requires {1} type argument(s).": { - "category": "Error", - "code": 2314 - }, - "Type '{0}' is not generic.": { - "category": "Error", - "code": 2315 - }, - "Global type '{0}' must be a class or interface type.": { - "category": "Error", - "code": 2316 - }, - "Global type '{0}' must have {1} type parameter(s).": { - "category": "Error", - "code": 2317 - }, - "Cannot find global type '{0}'.": { - "category": "Error", - "code": 2318 - }, - "Named property '{0}' of types '{1}' and '{2}' are not identical.": { - "category": "Error", - "code": 2319 - }, - "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'.": { - "category": "Error", - "code": 2320 - }, - "Excessive stack depth comparing types '{0}' and '{1}'.": { - "category": "Error", - "code": 2321 - }, - "Type '{0}' is not assignable to type '{1}'.": { - "category": "Error", - "code": 2322 - }, - "Cannot redeclare exported variable '{0}'.": { - "category": "Error", - "code": 2323 - }, - "Property '{0}' is missing in type '{1}'.": { - "category": "Error", - "code": 2324 - }, - "Property '{0}' is private in type '{1}' but not in type '{2}'.": { - "category": "Error", - "code": 2325 - }, - "Types of property '{0}' are incompatible.": { - "category": "Error", - "code": 2326 - }, - "Property '{0}' is optional in type '{1}' but required in type '{2}'.": { - "category": "Error", - "code": 2327 - }, - "Types of parameters '{0}' and '{1}' are incompatible.": { - "category": "Error", - "code": 2328 - }, - "Index signature is missing in type '{0}'.": { - "category": "Error", - "code": 2329 - }, - "Index signatures are incompatible.": { - "category": "Error", - "code": 2330 - }, - "'this' cannot be referenced in a module or namespace body.": { - "category": "Error", - "code": 2331 - }, - "'this' cannot be referenced in current location.": { - "category": "Error", - "code": 2332 - }, - "'this' cannot be referenced in constructor arguments.": { - "category": "Error", - "code": 2333 - }, - "'this' cannot be referenced in a static property initializer.": { - "category": "Error", - "code": 2334 - }, - "'super' can only be referenced in a derived class.": { - "category": "Error", - "code": 2335 - }, - "'super' cannot be referenced in constructor arguments.": { - "category": "Error", - "code": 2336 - }, - "Super calls are not permitted outside constructors or in nested functions inside constructors.": { - "category": "Error", - "code": 2337 - }, - "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.": { - "category": "Error", - "code": 2338 - }, - "Property '{0}' does not exist on type '{1}'.": { - "category": "Error", - "code": 2339 - }, - "Only public and protected methods of the base class are accessible via the 'super' keyword.": { - "category": "Error", - "code": 2340 - }, - "Property '{0}' is private and only accessible within class '{1}'.": { - "category": "Error", - "code": 2341 - }, - "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.": { - "category": "Error", - "code": 2342 - }, - "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'.": { - "category": "Error", - "code": 2343 - }, - "Type '{0}' does not satisfy the constraint '{1}'.": { - "category": "Error", - "code": 2344 - }, - "Argument of type '{0}' is not assignable to parameter of type '{1}'.": { - "category": "Error", - "code": 2345 - }, - "Call target does not contain any signatures.": { - "category": "Error", - "code": 2346 - }, - "Untyped function calls may not accept type arguments.": { - "category": "Error", - "code": 2347 - }, - "Value of type '{0}' is not callable. Did you mean to include 'new'?": { - "category": "Error", - "code": 2348 - }, - "This expression is not callable.": { - "category": "Error", - "code": 2349 - }, - "Only a void function can be called with the 'new' keyword.": { - "category": "Error", - "code": 2350 - }, - "This expression is not constructable.": { - "category": "Error", - "code": 2351 - }, - "Conversion of type '{0}' to type '{1}' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": { - "category": "Error", - "code": 2352 - }, - "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'.": { - "category": "Error", - "code": 2353 - }, - "This syntax requires an imported helper but module '{0}' cannot be found.": { - "category": "Error", - "code": 2354 - }, - "A function whose declared type is neither 'void' nor 'any' must return a value.": { - "category": "Error", - "code": 2355 - }, - "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.": { - "category": "Error", - "code": 2356 - }, - "The operand of an increment or decrement operator must be a variable or a property access.": { - "category": "Error", - "code": 2357 - }, - "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": { - "category": "Error", - "code": 2358 - }, - "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.": { - "category": "Error", - "code": 2359 - }, - "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.": { - "category": "Error", - "code": 2360 - }, - "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": { - "category": "Error", - "code": 2361 - }, - "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.": { - "category": "Error", - "code": 2362 - }, - "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.": { - "category": "Error", - "code": 2363 - }, - "The left-hand side of an assignment expression must be a variable or a property access.": { - "category": "Error", - "code": 2364 - }, - "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": { - "category": "Error", - "code": 2365 - }, - "Function lacks ending return statement and return type does not include 'undefined'.": { - "category": "Error", - "code": 2366 - }, - "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap.": { - "category": "Error", - "code": 2367 - }, - "Type parameter name cannot be '{0}'.": { - "category": "Error", - "code": 2368 - }, - "A parameter property is only allowed in a constructor implementation.": { - "category": "Error", - "code": 2369 - }, - "A rest parameter must be of an array type.": { - "category": "Error", - "code": 2370 - }, - "A parameter initializer is only allowed in a function or constructor implementation.": { - "category": "Error", - "code": 2371 - }, - "Parameter '{0}' cannot reference itself.": { - "category": "Error", - "code": 2372 - }, - "Parameter '{0}' cannot reference identifier '{1}' declared after it.": { - "category": "Error", - "code": 2373 - }, - "Duplicate string index signature.": { - "category": "Error", - "code": 2374 - }, - "Duplicate number index signature.": { - "category": "Error", - "code": 2375 - }, - "A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.": { - "category": "Error", - "code": 2376 - }, - "Constructors for derived classes must contain a 'super' call.": { - "category": "Error", - "code": 2377 - }, - "A 'get' accessor must return a value.": { - "category": "Error", - "code": 2378 - }, - "Getter and setter accessors do not agree in visibility.": { - "category": "Error", - "code": 2379 - }, - "'get' and 'set' accessor must have the same type.": { - "category": "Error", - "code": 2380 - }, - "A signature with an implementation cannot use a string literal type.": { - "category": "Error", - "code": 2381 - }, - "Specialized overload signature is not assignable to any non-specialized signature.": { - "category": "Error", - "code": 2382 - }, - "Overload signatures must all be exported or non-exported.": { - "category": "Error", - "code": 2383 - }, - "Overload signatures must all be ambient or non-ambient.": { - "category": "Error", - "code": 2384 - }, - "Overload signatures must all be public, private or protected.": { - "category": "Error", - "code": 2385 - }, - "Overload signatures must all be optional or required.": { - "category": "Error", - "code": 2386 - }, - "Function overload must be static.": { - "category": "Error", - "code": 2387 - }, - "Function overload must not be static.": { - "category": "Error", - "code": 2388 - }, - "Function implementation name must be '{0}'.": { - "category": "Error", - "code": 2389 - }, - "Constructor implementation is missing.": { - "category": "Error", - "code": 2390 - }, - "Function implementation is missing or not immediately following the declaration.": { - "category": "Error", - "code": 2391 - }, - "Multiple constructor implementations are not allowed.": { - "category": "Error", - "code": 2392 - }, - "Duplicate function implementation.": { - "category": "Error", - "code": 2393 - }, - "This overload signature is not compatible with its implementation signature.": { - "category": "Error", - "code": 2394 - }, - "Individual declarations in merged declaration '{0}' must be all exported or all local.": { - "category": "Error", - "code": 2395 - }, - "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.": { - "category": "Error", - "code": 2396 - }, - "Declaration name conflicts with built-in global identifier '{0}'.": { - "category": "Error", - "code": 2397 - }, - "'constructor' cannot be used as a parameter property name.": { - "category": "Error", - "code": 2398 - }, - "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.": { - "category": "Error", - "code": 2399 - }, - "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.": { - "category": "Error", - "code": 2400 - }, - "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.": { - "category": "Error", - "code": 2401 - }, - "Expression resolves to '_super' that compiler uses to capture base class reference.": { - "category": "Error", - "code": 2402 - }, - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": { - "category": "Error", - "code": 2403 - }, - "The left-hand side of a 'for...in' statement cannot use a type annotation.": { - "category": "Error", - "code": 2404 - }, - "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.": { - "category": "Error", - "code": 2405 - }, - "The left-hand side of a 'for...in' statement must be a variable or a property access.": { - "category": "Error", - "code": 2406 - }, - "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.": { - "category": "Error", - "code": 2407 - }, - "Setters cannot return a value.": { - "category": "Error", - "code": 2408 - }, - "Return type of constructor signature must be assignable to the instance type of the class.": { - "category": "Error", - "code": 2409 - }, - "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.": { - "category": "Error", - "code": 2410 - }, - "Property '{0}' of type '{1}' is not assignable to string index type '{2}'.": { - "category": "Error", - "code": 2411 - }, - "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'.": { - "category": "Error", - "code": 2412 - }, - "Numeric index type '{0}' is not assignable to string index type '{1}'.": { - "category": "Error", - "code": 2413 - }, - "Class name cannot be '{0}'.": { - "category": "Error", - "code": 2414 - }, - "Class '{0}' incorrectly extends base class '{1}'.": { - "category": "Error", - "code": 2415 - }, - "Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'.": { - "category": "Error", - "code": 2416 - }, - "Class static side '{0}' incorrectly extends base class static side '{1}'.": { - "category": "Error", - "code": 2417 - }, - "Type of computed property's value is '{0}', which is not assignable to type '{1}'.": { - "category": "Error", - "code": 2418 - }, - "Types of construct signatures are incompatible.": { - "category": "Error", - "code": 2419 - }, - "Class '{0}' incorrectly implements interface '{1}'.": { - "category": "Error", - "code": 2420 - }, - "A class can only implement an object type or intersection of object types with statically known members.": { - "category": "Error", - "code": 2422 - }, - "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": { - "category": "Error", - "code": 2423 - }, - "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": { - "category": "Error", - "code": 2425 - }, - "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": { - "category": "Error", - "code": 2426 - }, - "Interface name cannot be '{0}'.": { - "category": "Error", - "code": 2427 - }, - "All declarations of '{0}' must have identical type parameters.": { - "category": "Error", - "code": 2428 - }, - "Interface '{0}' incorrectly extends interface '{1}'.": { - "category": "Error", - "code": 2430 - }, - "Enum name cannot be '{0}'.": { - "category": "Error", - "code": 2431 - }, - "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.": { - "category": "Error", - "code": 2432 - }, - "A namespace declaration cannot be in a different file from a class or function with which it is merged.": { - "category": "Error", - "code": 2433 - }, - "A namespace declaration cannot be located prior to a class or function with which it is merged.": { - "category": "Error", - "code": 2434 - }, - "Ambient modules cannot be nested in other modules or namespaces.": { - "category": "Error", - "code": 2435 - }, - "Ambient module declaration cannot specify relative module name.": { - "category": "Error", - "code": 2436 - }, - "Module '{0}' is hidden by a local declaration with the same name.": { - "category": "Error", - "code": 2437 - }, - "Import name cannot be '{0}'.": { - "category": "Error", - "code": 2438 - }, - "Import or export declaration in an ambient module declaration cannot reference module through relative module name.": { - "category": "Error", - "code": 2439 - }, - "Import declaration conflicts with local declaration of '{0}'.": { - "category": "Error", - "code": 2440 - }, - "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module.": { - "category": "Error", - "code": 2441 - }, - "Types have separate declarations of a private property '{0}'.": { - "category": "Error", - "code": 2442 - }, - "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'.": { - "category": "Error", - "code": 2443 - }, - "Property '{0}' is protected in type '{1}' but public in type '{2}'.": { - "category": "Error", - "code": 2444 - }, - "Property '{0}' is protected and only accessible within class '{1}' and its subclasses.": { - "category": "Error", - "code": 2445 - }, - "Property '{0}' is protected and only accessible through an instance of class '{1}'.": { - "category": "Error", - "code": 2446 - }, - "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead.": { - "category": "Error", - "code": 2447 - }, - "Block-scoped variable '{0}' used before its declaration.": { - "category": "Error", - "code": 2448 - }, - "Class '{0}' used before its declaration.": { - "category": "Error", - "code": 2449 - }, - "Enum '{0}' used before its declaration.": { - "category": "Error", - "code": 2450 - }, - "Cannot redeclare block-scoped variable '{0}'.": { - "category": "Error", - "code": 2451 - }, - "An enum member cannot have a numeric name.": { - "category": "Error", - "code": 2452 - }, - "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly.": { - "category": "Error", - "code": 2453 - }, - "Variable '{0}' is used before being assigned.": { - "category": "Error", - "code": 2454 - }, - "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.": { - "category": "Error", - "code": 2455 - }, - "Type alias '{0}' circularly references itself.": { - "category": "Error", - "code": 2456 - }, - "Type alias name cannot be '{0}'.": { - "category": "Error", - "code": 2457 - }, - "An AMD module cannot have multiple name assignments.": { - "category": "Error", - "code": 2458 - }, - "Module '{0}' declares '{1}' locally, but it is not exported.": { - "category": "Error", - "code": 2459 - }, - "Module '{0}' declares '{1}' locally, but it is exported as '{2}'.": { - "category": "Error", - "code": 2460 - }, - "Type '{0}' is not an array type.": { - "category": "Error", - "code": 2461 - }, - "A rest element must be last in a destructuring pattern.": { - "category": "Error", - "code": 2462 - }, - "A binding pattern parameter cannot be optional in an implementation signature.": { - "category": "Error", - "code": 2463 - }, - "A computed property name must be of type 'string', 'number', 'symbol', or 'any'.": { - "category": "Error", - "code": 2464 - }, - "'this' cannot be referenced in a computed property name.": { - "category": "Error", - "code": 2465 - }, - "'super' cannot be referenced in a computed property name.": { - "category": "Error", - "code": 2466 - }, - "A computed property name cannot reference a type parameter from its containing type.": { - "category": "Error", - "code": 2467 - }, - "Cannot find global value '{0}'.": { - "category": "Error", - "code": 2468 - }, - "The '{0}' operator cannot be applied to type 'symbol'.": { - "category": "Error", - "code": 2469 - }, - "'Symbol' reference does not refer to the global Symbol constructor object.": { - "category": "Error", - "code": 2470 - }, - "A computed property name of the form '{0}' must be of type 'symbol'.": { - "category": "Error", - "code": 2471 - }, - "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher.": { - "category": "Error", - "code": 2472 - }, - "Enum declarations must all be const or non-const.": { - "category": "Error", - "code": 2473 - }, - "const enum member initializers can only contain literal values and other computed enum values.": { - "category": "Error", - "code": 2474 - }, - "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query.": { - "category": "Error", - "code": 2475 - }, - "A const enum member can only be accessed using a string literal.": { - "category": "Error", - "code": 2476 - }, - "'const' enum member initializer was evaluated to a non-finite value.": { - "category": "Error", - "code": 2477 - }, - "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { - "category": "Error", - "code": 2478 - }, - "Property '{0}' does not exist on 'const' enum '{1}'.": { - "category": "Error", - "code": 2479 - }, - "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { - "category": "Error", - "code": 2480 - }, - "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { - "category": "Error", - "code": 2481 - }, - "The left-hand side of a 'for...of' statement cannot use a type annotation.": { - "category": "Error", - "code": 2483 - }, - "Export declaration conflicts with exported declaration of '{0}'.": { - "category": "Error", - "code": 2484 - }, - "The left-hand side of a 'for...of' statement must be a variable or a property access.": { - "category": "Error", - "code": 2487 - }, - "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.": { - "category": "Error", - "code": 2488 - }, - "An iterator must have a 'next()' method.": { - "category": "Error", - "code": 2489 - }, - "The type returned by the '{0}()' method of an iterator must have a 'value' property.": { - "category": "Error", - "code": 2490 - }, - "The left-hand side of a 'for...in' statement cannot be a destructuring pattern.": { - "category": "Error", - "code": 2491 - }, - "Cannot redeclare identifier '{0}' in catch clause.": { - "category": "Error", - "code": 2492 - }, - "Tuple type '{0}' of length '{1}' has no element at index '{2}'.": { - "category": "Error", - "code": 2493 - }, - "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.": { - "category": "Error", - "code": 2494 - }, - "Type '{0}' is not an array type or a string type.": { - "category": "Error", - "code": 2495 - }, - "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.": { - "category": "Error", - "code": 2496 - }, - "This module can only be referenced with ECMAScript imports/exports by turning on the '{0}' flag and referencing its default export.": { - "category": "Error", - "code": 2497 - }, - "Module '{0}' uses 'export =' and cannot be used with 'export *'.": { - "category": "Error", - "code": 2498 - }, - "An interface can only extend an identifier/qualified-name with optional type arguments.": { - "category": "Error", - "code": 2499 - }, - "A class can only implement an identifier/qualified-name with optional type arguments.": { - "category": "Error", - "code": 2500 - }, - "A rest element cannot contain a binding pattern.": { - "category": "Error", - "code": 2501 - }, - "'{0}' is referenced directly or indirectly in its own type annotation.": { - "category": "Error", - "code": 2502 - }, - "Cannot find namespace '{0}'.": { - "category": "Error", - "code": 2503 - }, - "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.": { - "category": "Error", - "code": 2504 - }, - "A generator cannot have a 'void' type annotation.": { - "category": "Error", - "code": 2505 - }, - "'{0}' is referenced directly or indirectly in its own base expression.": { - "category": "Error", - "code": 2506 - }, - "Type '{0}' is not a constructor function type.": { - "category": "Error", - "code": 2507 - }, - "No base constructor has the specified number of type arguments.": { - "category": "Error", - "code": 2508 - }, - "Base constructor return type '{0}' is not an object type or intersection of object types with statically known members.": { - "category": "Error", - "code": 2509 - }, - "Base constructors must all have the same return type.": { - "category": "Error", - "code": 2510 - }, - "Cannot create an instance of an abstract class.": { - "category": "Error", - "code": 2511 - }, - "Overload signatures must all be abstract or non-abstract.": { - "category": "Error", - "code": 2512 - }, - "Abstract method '{0}' in class '{1}' cannot be accessed via super expression.": { - "category": "Error", - "code": 2513 - }, - "Classes containing abstract methods must be marked abstract.": { - "category": "Error", - "code": 2514 - }, - "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'.": { - "category": "Error", - "code": 2515 - }, - "All declarations of an abstract method must be consecutive.": { - "category": "Error", - "code": 2516 - }, - "Cannot assign an abstract constructor type to a non-abstract constructor type.": { - "category": "Error", - "code": 2517 - }, - "A 'this'-based type guard is not compatible with a parameter-based type guard.": { - "category": "Error", - "code": 2518 - }, - "An async iterator must have a 'next()' method.": { - "category": "Error", - "code": 2519 - }, - "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": { - "category": "Error", - "code": 2520 - }, - "Expression resolves to variable declaration '{0}' that compiler uses to support async functions.": { - "category": "Error", - "code": 2521 - }, - "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method.": { - "category": "Error", - "code": 2522 - }, - "'yield' expressions cannot be used in a parameter initializer.": { - "category": "Error", - "code": 2523 - }, - "'await' expressions cannot be used in a parameter initializer.": { - "category": "Error", - "code": 2524 - }, - "Initializer provides no value for this binding element and the binding element has no default value.": { - "category": "Error", - "code": 2525 - }, - "A 'this' type is available only in a non-static member of a class or interface.": { - "category": "Error", - "code": 2526 - }, - "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary.": { - "category": "Error", - "code": 2527 - }, - "A module cannot have multiple default exports.": { - "category": "Error", - "code": 2528 - }, - "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions.": { - "category": "Error", - "code": 2529 - }, - "Property '{0}' is incompatible with index signature.": { - "category": "Error", - "code": 2530 - }, - "Object is possibly 'null'.": { - "category": "Error", - "code": 2531 - }, - "Object is possibly 'undefined'.": { - "category": "Error", - "code": 2532 - }, - "Object is possibly 'null' or 'undefined'.": { - "category": "Error", - "code": 2533 - }, - "A function returning 'never' cannot have a reachable end point.": { - "category": "Error", - "code": 2534 - }, - "Enum type '{0}' has members with initializers that are not literals.": { - "category": "Error", - "code": 2535 - }, - "Type '{0}' cannot be used to index type '{1}'.": { - "category": "Error", - "code": 2536 - }, - "Type '{0}' has no matching index signature for type '{1}'.": { - "category": "Error", - "code": 2537 - }, - "Type '{0}' cannot be used as an index type.": { - "category": "Error", - "code": 2538 - }, - "Cannot assign to '{0}' because it is not a variable.": { - "category": "Error", - "code": 2539 - }, - "Cannot assign to '{0}' because it is a read-only property.": { - "category": "Error", - "code": 2540 - }, - "The target of an assignment must be a variable or a property access.": { - "category": "Error", - "code": 2541 - }, - "Index signature in type '{0}' only permits reading.": { - "category": "Error", - "code": 2542 - }, - "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference.": { - "category": "Error", - "code": 2543 - }, - "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference.": { - "category": "Error", - "code": 2544 - }, - "A mixin class must have a constructor with a single rest parameter of type 'any[]'.": { - "category": "Error", - "code": 2545 - }, - "The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property.": { - "category": "Error", - "code": 2547 - }, - "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator.": { - "category": "Error", - "code": 2548 - }, - "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator.": { - "category": "Error", - "code": 2549 - }, - "Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the `lib` compiler option to '{2}' or later.": { - "category": "Error", - "code": 2550 - }, - "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?": { - "category": "Error", - "code": 2551 - }, - "Cannot find name '{0}'. Did you mean '{1}'?": { - "category": "Error", - "code": 2552 - }, - "Computed values are not permitted in an enum with string valued members.": { - "category": "Error", - "code": 2553 - }, - "Expected {0} arguments, but got {1}.": { - "category": "Error", - "code": 2554 - }, - "Expected at least {0} arguments, but got {1}.": { - "category": "Error", - "code": 2555 - }, - "Expected {0} arguments, but got {1} or more.": { - "category": "Error", - "code": 2556 - }, - "Expected at least {0} arguments, but got {1} or more.": { - "category": "Error", - "code": 2557 - }, - "Expected {0} type arguments, but got {1}.": { - "category": "Error", - "code": 2558 - }, - "Type '{0}' has no properties in common with type '{1}'.": { - "category": "Error", - "code": 2559 - }, - "Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?": { - "category": "Error", - "code": 2560 - }, - "Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?": { - "category": "Error", - "code": 2561 - }, - "Base class expressions cannot reference class type parameters.": { - "category": "Error", - "code": 2562 - }, - "The containing function or module body is too large for control flow analysis.": { - "category": "Error", - "code": 2563 - }, - "Property '{0}' has no initializer and is not definitely assigned in the constructor.": { - "category": "Error", - "code": 2564 - }, - "Property '{0}' is used before being assigned.": { - "category": "Error", - "code": 2565 - }, - "A rest element cannot have a property name.": { - "category": "Error", - "code": 2566 - }, - "Enum declarations can only merge with namespace or other enum declarations.": { - "category": "Error", - "code": 2567 - }, - "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.": { - "category": "Error", - "code": 2569 - }, - "Object is of type 'unknown'.": { - "category": "Error", - "code": 2571 - }, - "Rest signatures are incompatible.": { - "category": "Error", - "code": 2572 - }, - "Property '{0}' is incompatible with rest element type.": { - "category": "Error", - "code": 2573 - }, - "A rest element type must be an array type.": { - "category": "Error", - "code": 2574 - }, - "No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments.": { - "category": "Error", - "code": 2575 - }, - "Property '{0}' does not exist on type '{1}'. Did you mean to access the static member '{2}' instead?": { - "category": "Error", - "code": 2576 - }, - "Return type annotation circularly references itself.": { - "category": "Error", - "code": 2577 - }, - "Unused '@ts-expect-error' directive.": { - "category": "Error", - "code": 2578 - }, - "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.": { - "category": "Error", - "code": 2580 - }, - "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.": { - "category": "Error", - "code": 2581 - }, - "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.": { - "category": "Error", - "code": 2582 - }, - "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to '{1}' or later.": { - "category": "Error", - "code": 2583 - }, - "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.": { - "category": "Error", - "code": 2584 - }, - "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.": { - "category": "Error", - "code": 2585 - }, - "Enum type '{0}' circularly references itself.": { - "category": "Error", - "code": 2586 - }, - "JSDoc type '{0}' circularly references itself.": { - "category": "Error", - "code": 2587 - }, - "Cannot assign to '{0}' because it is a constant.": { - "category": "Error", - "code": 2588 - }, - "Type instantiation is excessively deep and possibly infinite.": { - "category": "Error", - "code": 2589 - }, - "Expression produces a union type that is too complex to represent.": { - "category": "Error", - "code": 2590 - }, - "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add `node` to the types field in your tsconfig.": { - "category": "Error", - "code": 2591 - }, - "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add `jquery` to the types field in your tsconfig.": { - "category": "Error", - "code": 2592 - }, - "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig.": { - "category": "Error", - "code": 2593 - }, - "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag.": { - "category": "Error", - "code": 2594 - }, - "'{0}' can only be imported by using a default import.": { - "category": "Error", - "code": 2595 - }, - "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import.": { - "category": "Error", - "code": 2596 - }, - "'{0}' can only be imported by using a 'require' call or by using a default import.": { - "category": "Error", - "code": 2597 - }, - "'{0}' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import.": { - "category": "Error", - "code": 2598 - }, - "JSX element attributes type '{0}' may not be a union type.": { - "category": "Error", - "code": 2600 - }, - "The return type of a JSX element constructor must return an object type.": { - "category": "Error", - "code": 2601 - }, - "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist.": { - "category": "Error", - "code": 2602 - }, - "Property '{0}' in type '{1}' is not assignable to type '{2}'.": { - "category": "Error", - "code": 2603 - }, - "JSX element type '{0}' does not have any construct or call signatures.": { - "category": "Error", - "code": 2604 - }, - "JSX element type '{0}' is not a constructor function for JSX elements.": { - "category": "Error", - "code": 2605 - }, - "Property '{0}' of JSX spread attribute is not assignable to target property.": { - "category": "Error", - "code": 2606 - }, - "JSX element class does not support attributes because it does not have a '{0}' property.": { - "category": "Error", - "code": 2607 - }, - "The global type 'JSX.{0}' may not have more than one property.": { - "category": "Error", - "code": 2608 - }, - "JSX spread child must be an array type.": { - "category": "Error", - "code": 2609 - }, - "'{0}' is defined as an accessor in class '{1}', but is overridden here in '{2}' as an instance property.": { - "category": "Error", - "code": 2610 - }, - "'{0}' is defined as a property in class '{1}', but is overridden here in '{2}' as an accessor.": { - "category": "Error", - "code": 2611 - }, - "Property '{0}' will overwrite the base property in '{1}'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.": { - "category": "Error", - "code": 2612 - }, - "Module '{0}' has no default export. Did you mean to use 'import { {1} } from {0}' instead?": { - "category": "Error", - "code": 2613 - }, - "Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?": { - "category": "Error", - "code": 2614 - }, - "Type of property '{0}' circularly references itself in mapped type '{1}'.": { - "category": "Error", - "code": 2615 - }, - "'{0}' can only be imported by using 'import {1} = require({2})' or a default import.": { - "category": "Error", - "code": 2616 - }, - "'{0}' can only be imported by using 'import {1} = require({2})' or by turning on the 'esModuleInterop' flag and using a default import.": { - "category": "Error", - "code": 2617 - }, - "Source has {0} element(s) but target requires {1}.": { - "category": "Error", - "code": 2618 - }, - "Source has {0} element(s) but target allows only {1}.": { - "category": "Error", - "code": 2619 - }, - "Target requires {0} element(s) but source may have fewer.": { - "category": "Error", - "code": 2620 - }, - "Target allows only {0} element(s) but source may have more.": { - "category": "Error", - "code": 2621 - }, - "Element at index {0} is variadic in one type but not in the other.": { - "category": "Error", - "code": 2622 - }, - - "Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": { - "category": "Error", - "code": 2649 - }, - "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.": { - "category": "Error", - "code": 2651 - }, - "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.": { - "category": "Error", - "code": 2652 - }, - "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.": { - "category": "Error", - "code": 2653 - }, - "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": { - "category": "Error", - "code": 2654 - }, - "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": { - "category": "Error", - "code": 2656 - }, - "JSX expressions must have one parent element.": { - "category": "Error", - "code": 2657 - }, - "Type '{0}' provides no match for the signature '{1}'.": { - "category": "Error", - "code": 2658 - }, - "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.": { - "category": "Error", - "code": 2659 - }, - "'super' can only be referenced in members of derived classes or object literal expressions.": { - "category": "Error", - "code": 2660 - }, - "Cannot export '{0}'. Only local declarations can be exported from a module.": { - "category": "Error", - "code": 2661 - }, - "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?": { - "category": "Error", - "code": 2662 - }, - "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?": { - "category": "Error", - "code": 2663 - }, - "Invalid module name in augmentation, module '{0}' cannot be found.": { - "category": "Error", - "code": 2664 - }, - "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented.": { - "category": "Error", - "code": 2665 - }, - "Exports and export assignments are not permitted in module augmentations.": { - "category": "Error", - "code": 2666 - }, - "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module.": { - "category": "Error", - "code": 2667 - }, - "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.": { - "category": "Error", - "code": 2668 - }, - "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.": { - "category": "Error", - "code": 2669 - }, - "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context.": { - "category": "Error", - "code": 2670 - }, - "Cannot augment module '{0}' because it resolves to a non-module entity.": { - "category": "Error", - "code": 2671 - }, - "Cannot assign a '{0}' constructor type to a '{1}' constructor type.": { - "category": "Error", - "code": 2672 - }, - "Constructor of class '{0}' is private and only accessible within the class declaration.": { - "category": "Error", - "code": 2673 - }, - "Constructor of class '{0}' is protected and only accessible within the class declaration.": { - "category": "Error", - "code": 2674 - }, - "Cannot extend a class '{0}'. Class constructor is marked as private.": { - "category": "Error", - "code": 2675 - }, - "Accessors must both be abstract or non-abstract.": { - "category": "Error", - "code": 2676 - }, - "A type predicate's type must be assignable to its parameter's type.": { - "category": "Error", - "code": 2677 - }, - "Type '{0}' is not comparable to type '{1}'.": { - "category": "Error", - "code": 2678 - }, - "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.": { - "category": "Error", - "code": 2679 - }, - "A '{0}' parameter must be the first parameter.": { - "category": "Error", - "code": 2680 - }, - "A constructor cannot have a 'this' parameter.": { - "category": "Error", - "code": 2681 - }, - "'get' and 'set' accessor must have the same 'this' type.": { - "category": "Error", - "code": 2682 - }, - "'this' implicitly has type 'any' because it does not have a type annotation.": { - "category": "Error", - "code": 2683 - }, - "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'.": { - "category": "Error", - "code": 2684 - }, - "The 'this' types of each signature are incompatible.": { - "category": "Error", - "code": 2685 - }, - "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead.": { - "category": "Error", - "code": 2686 - }, - "All declarations of '{0}' must have identical modifiers.": { - "category": "Error", - "code": 2687 - }, - "Cannot find type definition file for '{0}'.": { - "category": "Error", - "code": 2688 - }, - "Cannot extend an interface '{0}'. Did you mean 'implements'?": { - "category": "Error", - "code": 2689 - }, - "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?": { - "category": "Error", - "code": 2690 - }, - "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead.": { - "category": "Error", - "code": 2691 - }, - "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible.": { - "category": "Error", - "code": 2692 - }, - "'{0}' only refers to a type, but is being used as a value here.": { - "category": "Error", - "code": 2693 - }, - "Namespace '{0}' has no exported member '{1}'.": { - "category": "Error", - "code": 2694 - }, - "Left side of comma operator is unused and has no side effects.": { - "category": "Error", - "code": 2695, - "reportsUnnecessary": true - }, - "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?": { - "category": "Error", - "code": 2696 - }, - "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.": { - "category": "Error", - "code": 2697 - }, - "Spread types may only be created from object types.": { - "category": "Error", - "code": 2698 - }, - "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'.": { - "category": "Error", - "code": 2699 - }, - "Rest types may only be created from object types.": { - "category": "Error", - "code": 2700 - }, - "The target of an object rest assignment must be a variable or a property access.": { - "category": "Error", - "code": 2701 - }, - "'{0}' only refers to a type, but is being used as a namespace here.": { - "category": "Error", - "code": 2702 - }, - "The operand of a 'delete' operator must be a property reference.": { - "category": "Error", - "code": 2703 - }, - "The operand of a 'delete' operator cannot be a read-only property.": { - "category": "Error", - "code": 2704 - }, - "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.": { - "category": "Error", - "code": 2705 - }, - "Required type parameters may not follow optional type parameters.": { - "category": "Error", - "code": 2706 - }, - "Generic type '{0}' requires between {1} and {2} type arguments.": { - "category": "Error", - "code": 2707 - }, - "Cannot use namespace '{0}' as a value.": { - "category": "Error", - "code": 2708 - }, - "Cannot use namespace '{0}' as a type.": { - "category": "Error", - "code": 2709 - }, - "'{0}' are specified twice. The attribute named '{0}' will be overwritten.": { - "category": "Error", - "code": 2710 - }, - "A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.": { - "category": "Error", - "code": 2711 - }, - "A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.": { - "category": "Error", - "code": 2712 - }, - "Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}[\"{1}\"]'?": { - "category": "Error", - "code": 2713 - }, - "The expression of an export assignment must be an identifier or qualified name in an ambient context.": { - "category": "Error", - "code": 2714 - }, - "Abstract property '{0}' in class '{1}' cannot be accessed in the constructor.": { - "category": "Error", - "code": 2715 - }, - "Type parameter '{0}' has a circular default.": { - "category": "Error", - "code": 2716 - }, - "Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'.": { - "category": "Error", - "code": 2717 - }, - "Duplicate property '{0}'.": { - "category": "Error", - "code": 2718 - }, - "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated.": { - "category": "Error", - "code": 2719 - }, - "Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?": { - "category": "Error", - "code": 2720 - }, - "Cannot invoke an object which is possibly 'null'.": { - "category": "Error", - "code": 2721 - }, - "Cannot invoke an object which is possibly 'undefined'.": { - "category": "Error", - "code": 2722 - }, - "Cannot invoke an object which is possibly 'null' or 'undefined'.": { - "category": "Error", - "code": 2723 - }, - "'{0}' has no exported member named '{1}'. Did you mean '{2}'?": { - "category": "Error", - "code": 2724 - }, - "Class name cannot be 'Object' when targeting ES5 with module {0}.": { - "category": "Error", - "code": 2725 - }, - "Cannot find lib definition for '{0}'.": { - "category": "Error", - "code": 2726 - }, - "Cannot find lib definition for '{0}'. Did you mean '{1}'?": { - "category": "Error", - "code": 2727 - }, - "'{0}' is declared here.": { - "category": "Message", - "code": 2728 - }, - "Property '{0}' is used before its initialization.": { - "category": "Error", - "code": 2729 - }, - "An arrow function cannot have a 'this' parameter.": { - "category": "Error", - "code": 2730 - }, - "Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'.": { - "category": "Error", - "code": 2731 - }, - "Cannot find module '{0}'. Consider using '--resolveJsonModule' to import module with '.json' extension.": { - "category": "Error", - "code": 2732 - }, - "Property '{0}' was also declared here.": { - "category": "Error", - "code": 2733 - }, - "Are you missing a semicolon?": { - "category": "Error", - "code": 2734 - }, - "Did you mean for '{0}' to be constrained to type 'new (...args: any[]) => {1}'?": { - "category": "Error", - "code": 2735 - }, - "Operator '{0}' cannot be applied to type '{1}'.": { - "category": "Error", - "code": 2736 - }, - "BigInt literals are not available when targeting lower than ES2020.": { - "category": "Error", - "code": 2737 - }, - "An outer value of 'this' is shadowed by this container.": { - "category": "Message", - "code": 2738 - }, - "Type '{0}' is missing the following properties from type '{1}': {2}": { - "category": "Error", - "code": 2739 - }, - "Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more.": { - "category": "Error", - "code": 2740 - }, - "Property '{0}' is missing in type '{1}' but required in type '{2}'.": { - "category": "Error", - "code": 2741 - }, - "The inferred type of '{0}' cannot be named without a reference to '{1}'. This is likely not portable. A type annotation is necessary.": { - "category": "Error", - "code": 2742 - }, - "No overload expects {0} type arguments, but overloads do exist that expect either {1} or {2} type arguments.": { - "category": "Error", - "code": 2743 - }, - "Type parameter defaults can only reference previously declared type parameters.": { - "category": "Error", - "code": 2744 - }, - "This JSX tag's '{0}' prop expects type '{1}' which requires multiple children, but only a single child was provided.": { - "category": "Error", - "code": 2745 - }, - "This JSX tag's '{0}' prop expects a single child of type '{1}', but multiple children were provided.": { - "category": "Error", - "code": 2746 - }, - "'{0}' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of '{1}' is '{2}'.": { - "category": "Error", - "code": 2747 - }, - "Cannot access ambient const enums when the '--isolatedModules' flag is provided.": { - "category": "Error", - "code": 2748 - }, - "'{0}' refers to a value, but is being used as a type here. Did you mean 'typeof {0}'?": { - "category": "Error", - "code": 2749 - }, - "The implementation signature is declared here.": { - "category": "Error", - "code": 2750 - }, - "Circularity originates in type at this location.": { - "category": "Error", - "code": 2751 - }, - "The first export default is here.": { - "category": "Error", - "code": 2752 - }, - "Another export default is here.": { - "category": "Error", - "code": 2753 - }, - "'super' may not use type arguments.": { - "category": "Error", - "code": 2754 - }, - "No constituent of type '{0}' is callable.": { - "category": "Error", - "code": 2755 - }, - "Not all constituents of type '{0}' are callable.": { - "category": "Error", - "code": 2756 - }, - "Type '{0}' has no call signatures.": { - "category": "Error", - "code": 2757 - }, - "Each member of the union type '{0}' has signatures, but none of those signatures are compatible with each other.": { - "category": "Error", - "code": 2758 - }, - "No constituent of type '{0}' is constructable.": { - "category": "Error", - "code": 2759 - }, - "Not all constituents of type '{0}' are constructable.": { - "category": "Error", - "code": 2760 - }, - "Type '{0}' has no construct signatures.": { - "category": "Error", - "code": 2761 - }, - "Each member of the union type '{0}' has construct signatures, but none of those signatures are compatible with each other.": { - "category": "Error", - "code": 2762 - }, - "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'.": { - "category": "Error", - "code": 2763 - }, - "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'.": { - "category": "Error", - "code": 2764 - }, - "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'.": { - "category": "Error", - "code": 2765 - }, - "Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'.": { - "category": "Error", - "code": 2766 - }, - "The '{0}' property of an iterator must be a method.": { - "category": "Error", - "code": 2767 - }, - "The '{0}' property of an async iterator must be a method.": { - "category": "Error", - "code": 2768 - }, - "No overload matches this call.": { - "category": "Error", - "code": 2769 - }, - "The last overload gave the following error.": { - "category": "Error", - "code": 2770 - }, - "The last overload is declared here.": { - "category": "Error", - "code": 2771 - }, - "Overload {0} of {1}, '{2}', gave the following error.": { - "category": "Error", - "code": 2772 - }, - "Did you forget to use 'await'?": { - "category": "Error", - "code": 2773 - }, - "This condition will always return true since the function is always defined. Did you mean to call it instead?": { - "category": "Error", - "code": 2774 - }, - "Assertions require every name in the call target to be declared with an explicit type annotation.": { - "category": "Error", - "code": 2775 - }, - "Assertions require the call target to be an identifier or qualified name.": { - "category": "Error", - "code": 2776 - }, - "The operand of an increment or decrement operator may not be an optional property access.": { - "category": "Error", - "code": 2777 - }, - "The target of an object rest assignment may not be an optional property access.": { - "category": "Error", - "code": 2778 - }, - "The left-hand side of an assignment expression may not be an optional property access.": { - "category": "Error", - "code": 2779 - }, - "The left-hand side of a 'for...in' statement may not be an optional property access.": { - "category": "Error", - "code": 2780 - }, - "The left-hand side of a 'for...of' statement may not be an optional property access.": { - "category": "Error", - "code": 2781 - }, - "'{0}' needs an explicit type annotation.": { - "category": "Message", - "code": 2782 - }, - "'{0}' is specified more than once, so this usage will be overwritten.": { - "category": "Error", - "code": 2783 - }, - "'get' and 'set' accessors cannot declare 'this' parameters.": { - "category": "Error", - "code": 2784 - }, - "This spread always overwrites this property.": { - "category": "Error", - "code": 2785 - }, - "'{0}' cannot be used as a JSX component.": { - "category": "Error", - "code": 2786 - }, - "Its return type '{0}' is not a valid JSX element.": { - "category": "Error", - "code": 2787 - }, - "Its instance type '{0}' is not a valid JSX element.": { - "category": "Error", - "code": 2788 - }, - "Its element type '{0}' is not a valid JSX element.": { - "category": "Error", - "code": 2789 - }, - "The operand of a 'delete' operator must be optional.": { - "category": "Error", - "code": 2790 - }, - "Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later.": { - "category": "Error", - "code": 2791 - }, - "Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?": { - "category": "Error", - "code": 2792 - }, - "The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible.": { - "category": "Error", - "code": 2793 - }, - "Expected {0} arguments, but got {1}. Did you forget to include 'void' in your type argument to 'Promise'?": { - "category": "Error", - "code": 2794 - }, - "The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types.": { - "category": "Error", - "code": 2795 - }, - "It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.": { - "category": "Error", - "code": 2796 - }, - - "Import declaration '{0}' is using private name '{1}'.": { - "category": "Error", - "code": 4000 - }, - "Type parameter '{0}' of exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4002 - }, - "Type parameter '{0}' of exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4004 - }, - "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4006 - }, - "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4008 - }, - "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4010 - }, - "Type parameter '{0}' of public method from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4012 - }, - "Type parameter '{0}' of method from exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4014 - }, - "Type parameter '{0}' of exported function has or is using private name '{1}'.": { - "category": "Error", - "code": 4016 - }, - "Implements clause of exported class '{0}' has or is using private name '{1}'.": { - "category": "Error", - "code": 4019 - }, - "'extends' clause of exported class '{0}' has or is using private name '{1}'.": { - "category": "Error", - "code": 4020 - }, - "'extends' clause of exported class has or is using private name '{0}'.": { - "category": "Error", - "code": 4021 - }, - "'extends' clause of exported interface '{0}' has or is using private name '{1}'.": { - "category": "Error", - "code": 4022 - }, - "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4023 - }, - "Exported variable '{0}' has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4024 - }, - "Exported variable '{0}' has or is using private name '{1}'.": { - "category": "Error", - "code": 4025 - }, - "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4026 - }, - "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4027 - }, - "Public static property '{0}' of exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4028 - }, - "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4029 - }, - "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4030 - }, - "Public property '{0}' of exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4031 - }, - "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4032 - }, - "Property '{0}' of exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4033 - }, - "Parameter type of public static setter '{0}' from exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4034 - }, - "Parameter type of public static setter '{0}' from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4035 - }, - "Parameter type of public setter '{0}' from exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4036 - }, - "Parameter type of public setter '{0}' from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4037 - }, - "Return type of public static getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4038 - }, - "Return type of public static getter '{0}' from exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4039 - }, - "Return type of public static getter '{0}' from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4040 - }, - "Return type of public getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4041 - }, - "Return type of public getter '{0}' from exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4042 - }, - "Return type of public getter '{0}' from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4043 - }, - "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'.": { - "category": "Error", - "code": 4044 - }, - "Return type of constructor signature from exported interface has or is using private name '{0}'.": { - "category": "Error", - "code": 4045 - }, - "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'.": { - "category": "Error", - "code": 4046 - }, - "Return type of call signature from exported interface has or is using private name '{0}'.": { - "category": "Error", - "code": 4047 - }, - "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'.": { - "category": "Error", - "code": 4048 - }, - "Return type of index signature from exported interface has or is using private name '{0}'.": { - "category": "Error", - "code": 4049 - }, - "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named.": { - "category": "Error", - "code": 4050 - }, - "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'.": { - "category": "Error", - "code": 4051 - }, - "Return type of public static method from exported class has or is using private name '{0}'.": { - "category": "Error", - "code": 4052 - }, - "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named.": { - "category": "Error", - "code": 4053 - }, - "Return type of public method from exported class has or is using name '{0}' from private module '{1}'.": { - "category": "Error", - "code": 4054 - }, - "Return type of public method from exported class has or is using private name '{0}'.": { - "category": "Error", - "code": 4055 - }, - "Return type of method from exported interface has or is using name '{0}' from private module '{1}'.": { - "category": "Error", - "code": 4056 - }, - "Return type of method from exported interface has or is using private name '{0}'.": { - "category": "Error", - "code": 4057 - }, - "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named.": { - "category": "Error", - "code": 4058 - }, - "Return type of exported function has or is using name '{0}' from private module '{1}'.": { - "category": "Error", - "code": 4059 - }, - "Return type of exported function has or is using private name '{0}'.": { - "category": "Error", - "code": 4060 - }, - "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4061 - }, - "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4062 - }, - "Parameter '{0}' of constructor from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4063 - }, - "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4064 - }, - "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4065 - }, - "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4066 - }, - "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4067 - }, - "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4068 - }, - "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4069 - }, - "Parameter '{0}' of public static method from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4070 - }, - "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4071 - }, - "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4072 - }, - "Parameter '{0}' of public method from exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4073 - }, - "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4074 - }, - "Parameter '{0}' of method from exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4075 - }, - "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4076 - }, - "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4077 - }, - "Parameter '{0}' of exported function has or is using private name '{1}'.": { - "category": "Error", - "code": 4078 - }, - "Exported type alias '{0}' has or is using private name '{1}'.": { - "category": "Error", - "code": 4081 - }, - "Default export of the module has or is using private name '{0}'.": { - "category": "Error", - "code": 4082 - }, - "Type parameter '{0}' of exported type alias has or is using private name '{1}'.": { - "category": "Error", - "code": 4083 - }, - "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.": { - "category": "Error", - "code": 4090 - }, - "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4091 - }, - "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4092 - }, - "Property '{0}' of exported class expression may not be private or protected.": { - "category": "Error", - "code": 4094 - }, - "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4095 - }, - "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4096 - }, - "Public static method '{0}' of exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4097 - }, - "Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { - "category": "Error", - "code": 4098 - }, - "Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4099 - }, - "Public method '{0}' of exported class has or is using private name '{1}'.": { - "category": "Error", - "code": 4100 - }, - "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4101 - }, - "Method '{0}' of exported interface has or is using private name '{1}'.": { - "category": "Error", - "code": 4102 - }, - "Type parameter '{0}' of exported mapped object type is using private name '{1}'.": { - "category": "Error", - "code": 4103 - }, - "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'.": { - "category": "Error", - "code": 4104 - }, - "Private or protected member '{0}' cannot be accessed on a type parameter.": { - "category": "Error", - "code": 4105 - }, - "Parameter '{0}' of accessor has or is using private name '{1}'.": { - "category": "Error", - "code": 4106 - }, - "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'.": { - "category": "Error", - "code": 4107 - }, - "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named.": { - "category": "Error", - "code": 4108 - }, - "Type arguments for '{0}' circularly reference themselves.": { - "category": "Error", - "code": 4109 - }, - "Tuple type arguments circularly reference themselves.": { - "category": "Error", - "code": 4110 - }, - "Property '{0}' comes from an index signature, so it must be accessed with ['{0}'].": { - "category": "Error", - "code": 4111 - }, - "This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class.": { - "category": "Error", - "code": 4112 - }, - "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'.": { - "category": "Error", - "code": 4113 - }, - "This member must have an 'override' modifier because it overrides a member in the base class '{0}'.": { - "category": "Error", - "code": 4114 - }, - "This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class '{0}'.": { - "category": "Error", - "code": 4115 - }, - "This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class '{0}'.": { - "category": "Error", - "code": 4116 - }, - - "The current host does not support the '{0}' option.": { - "category": "Error", - "code": 5001 - }, - "Cannot find the common subdirectory path for the input files.": { - "category": "Error", - "code": 5009 - }, - "File specification cannot end in a recursive directory wildcard ('**'): '{0}'.": { - "category": "Error", - "code": 5010 - }, - "Cannot read file '{0}': {1}.": { - "category": "Error", - "code": 5012 - }, - "Failed to parse file '{0}': {1}.": { - "category": "Error", - "code": 5014 - }, - "Unknown compiler option '{0}'.": { - "category": "Error", - "code": 5023 - }, - "Compiler option '{0}' requires a value of type {1}.": { - "category": "Error", - "code": 5024 - }, - "Unknown compiler option '{0}'. Did you mean '{1}'?": { - "category": "Error", - "code": 5025 - }, - "Could not write file '{0}': {1}.": { - "category": "Error", - "code": 5033 - }, - "Option 'project' cannot be mixed with source files on a command line.": { - "category": "Error", - "code": 5042 - }, - "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher.": { - "category": "Error", - "code": 5047 - }, - "Option '{0}' cannot be specified when option 'target' is 'ES3'.": { - "category": "Error", - "code": 5048 - }, - "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": { - "category": "Error", - "code": 5051 - }, - "Option '{0}' cannot be specified without specifying option '{1}'.": { - "category": "Error", - "code": 5052 - }, - "Option '{0}' cannot be specified with option '{1}'.": { - "category": "Error", - "code": 5053 - }, - "A 'tsconfig.json' file is already defined at: '{0}'.": { - "category": "Error", - "code": 5054 - }, - "Cannot write file '{0}' because it would overwrite input file.": { - "category": "Error", - "code": 5055 - }, - "Cannot write file '{0}' because it would be overwritten by multiple input files.": { - "category": "Error", - "code": 5056 - }, - "Cannot find a tsconfig.json file at the specified directory: '{0}'.": { - "category": "Error", - "code": 5057 - }, - "The specified path does not exist: '{0}'.": { - "category": "Error", - "code": 5058 - }, - "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier.": { - "category": "Error", - "code": 5059 - }, - "Pattern '{0}' can have at most one '*' character.": { - "category": "Error", - "code": 5061 - }, - "Substitution '{0}' in pattern '{1}' can have at most one '*' character.": { - "category": "Error", - "code": 5062 - }, - "Substitutions for pattern '{0}' should be an array.": { - "category": "Error", - "code": 5063 - }, - "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'.": { - "category": "Error", - "code": 5064 - }, - "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'.": { - "category": "Error", - "code": 5065 - }, - "Substitutions for pattern '{0}' shouldn't be an empty array.": { - "category": "Error", - "code": 5066 - }, - "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name.": { - "category": "Error", - "code": 5067 - }, - "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.": { - "category": "Error", - "code": 5068 - }, - "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'.": { - "category": "Error", - "code": 5069 - }, - "Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy.": { - "category": "Error", - "code": 5070 - }, - "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'.": { - "category": "Error", - "code": 5071 - }, - "Unknown build option '{0}'.": { - "category": "Error", - "code": 5072 - }, - "Build option '{0}' requires a value of type {1}.": { - "category": "Error", - "code": 5073 - }, - "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified.": { - "category": "Error", - "code": 5074 - }, - "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'.": { - "category": "Error", - "code": 5075 - }, - "'{0}' and '{1}' operations cannot be mixed without parentheses.": { - "category": "Error", - "code": 5076 - }, - "Unknown build option '{0}'. Did you mean '{1}'?": { - "category": "Error", - "code": 5077 - }, - "Unknown watch option '{0}'.": { - "category": "Error", - "code": 5078 - }, - "Unknown watch option '{0}'. Did you mean '{1}'?": { - "category": "Error", - "code": 5079 - }, - "Watch option '{0}' requires a value of type {1}.": { - "category": "Error", - "code": 5080 - }, - "Cannot find a tsconfig.json file at the current directory: {0}.": { - "category": "Error", - "code": 5081 - }, - "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'.": { - "category": "Error", - "code": 5082 - }, - "Cannot read file '{0}'.": { - "category": "Error", - "code": 5083 - }, - "Tuple members must all have names or all not have names.": { - "category": "Error", - "code": 5084 - }, - "A tuple member cannot be both optional and rest.": { - "category": "Error", - "code": 5085 - }, - "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type.": { - "category": "Error", - "code": 5086 - }, - "A labeled tuple element is declared as rest with a `...` before the name, rather than before the type.": { - "category": "Error", - "code": 5087 - }, - "The inferred type of '{0}' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary.": { - "category": "Error", - "code": 5088 - }, - "Option '{0}' cannot be specified when option 'jsx' is '{1}'.": { - "category": "Error", - "code": 5089 - }, - "Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?": { - "category": "Error", - "code": 5090 - }, - - "Generates a sourcemap for each corresponding '.d.ts' file.": { - "category": "Message", - "code": 6000 - }, - "Concatenate and emit output to single file.": { - "category": "Message", - "code": 6001 - }, - "Generates corresponding '.d.ts' file.": { - "category": "Message", - "code": 6002 - }, - "Specify the location where debugger should locate map files instead of generated locations.": { - "category": "Message", - "code": 6003 - }, - "Specify the location where debugger should locate TypeScript files instead of source locations.": { - "category": "Message", - "code": 6004 - }, - "Watch input files.": { - "category": "Message", - "code": 6005 - }, - "Redirect output structure to the directory.": { - "category": "Message", - "code": 6006 - }, - "Do not erase const enum declarations in generated code.": { - "category": "Message", - "code": 6007 - }, - "Do not emit outputs if any errors were reported.": { - "category": "Message", - "code": 6008 - }, - "Do not emit comments to output.": { - "category": "Message", - "code": 6009 - }, - "Do not emit outputs.": { - "category": "Message", - "code": 6010 - }, - "Allow default imports from modules with no default export. This does not affect code emit, just typechecking.": { - "category": "Message", - "code": 6011 - }, - "Skip type checking of declaration files.": { - "category": "Message", - "code": 6012 - }, - "Do not resolve the real path of symlinks.": { - "category": "Message", - "code": 6013 - }, - "Only emit '.d.ts' declaration files.": { - "category": "Message", - "code": 6014 - }, - "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'.": { - "category": "Message", - "code": 6015 - }, - "Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'.": { - "category": "Message", - "code": 6016 - }, - "Print this message.": { - "category": "Message", - "code": 6017 - }, - "Print the compiler's version.": { - "category": "Message", - "code": 6019 - }, - "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.": { - "category": "Message", - "code": 6020 - }, - "Syntax: {0}": { - "category": "Message", - "code": 6023 - }, - "options": { - "category": "Message", - "code": 6024 - }, - "file": { - "category": "Message", - "code": 6025 - }, - "Examples: {0}": { - "category": "Message", - "code": 6026 - }, - "Options:": { - "category": "Message", - "code": 6027 - }, - "Version {0}": { - "category": "Message", - "code": 6029 - }, - "Insert command line options and files from a file.": { - "category": "Message", - "code": 6030 - }, - "Starting compilation in watch mode...": { - "category": "Message", - "code": 6031 - }, - "File change detected. Starting incremental compilation...": { - "category": "Message", - "code": 6032 - }, - "KIND": { - "category": "Message", - "code": 6034 - }, - "FILE": { - "category": "Message", - "code": 6035 - }, - "VERSION": { - "category": "Message", - "code": 6036 - }, - "LOCATION": { - "category": "Message", - "code": 6037 - }, - "DIRECTORY": { - "category": "Message", - "code": 6038 - }, - "STRATEGY": { - "category": "Message", - "code": 6039 - }, - "FILE OR DIRECTORY": { - "category": "Message", - "code": 6040 - }, - "Generates corresponding '.map' file.": { - "category": "Message", - "code": 6043 - }, - "Compiler option '{0}' expects an argument.": { - "category": "Error", - "code": 6044 - }, - "Unterminated quoted string in response file '{0}'.": { - "category": "Error", - "code": 6045 - }, - "Argument for '{0}' option must be: {1}.": { - "category": "Error", - "code": 6046 - }, - "Locale must be of the form or -. For example '{0}' or '{1}'.": { - "category": "Error", - "code": 6048 - }, - "Unsupported locale '{0}'.": { - "category": "Error", - "code": 6049 - }, - "Unable to open file '{0}'.": { - "category": "Error", - "code": 6050 - }, - "Corrupted locale file {0}.": { - "category": "Error", - "code": 6051 - }, - "Raise error on expressions and declarations with an implied 'any' type.": { - "category": "Message", - "code": 6052 - }, - "File '{0}' not found.": { - "category": "Error", - "code": 6053 - }, - "File '{0}' has an unsupported extension. The only supported extensions are {1}.": { - "category": "Error", - "code": 6054 - }, - "Suppress noImplicitAny errors for indexing objects lacking index signatures.": { - "category": "Message", - "code": 6055 - }, - "Do not emit declarations for code that has an '@internal' annotation.": { - "category": "Message", - "code": 6056 - }, - "Specify the root directory of input files. Use to control the output directory structure with --outDir.": { - "category": "Message", - "code": 6058 - }, - "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files.": { - "category": "Error", - "code": 6059 - }, - "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).": { - "category": "Message", - "code": 6060 - }, - "NEWLINE": { - "category": "Message", - "code": 6061 - }, - "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'null' on command line.": { - "category": "Error", - "code": 6064 - }, - "Enables experimental support for ES7 decorators.": { - "category": "Message", - "code": 6065 - }, - "Enables experimental support for emitting type metadata for decorators.": { - "category": "Message", - "code": 6066 - }, - "Enables experimental support for ES7 async functions.": { - "category": "Message", - "code": 6068 - }, - "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).": { - "category": "Message", - "code": 6069 - }, - "Initializes a TypeScript project and creates a tsconfig.json file.": { - "category": "Message", - "code": 6070 - }, - "Successfully created a tsconfig.json file.": { - "category": "Message", - "code": 6071 - }, - "Suppress excess property checks for object literals.": { - "category": "Message", - "code": 6072 - }, - "Stylize errors and messages using color and context (experimental).": { - "category": "Message", - "code": 6073 - }, - "Do not report errors on unused labels.": { - "category": "Message", - "code": 6074 - }, - "Report error when not all code paths in function return a value.": { - "category": "Message", - "code": 6075 - }, - "Report errors for fallthrough cases in switch statement.": { - "category": "Message", - "code": 6076 - }, - "Do not report errors on unreachable code.": { - "category": "Message", - "code": 6077 - }, - "Disallow inconsistently-cased references to the same file.": { - "category": "Message", - "code": 6078 - }, - "Specify library files to be included in the compilation.": { - "category": "Message", - "code": 6079 - }, - "Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'.": { - "category": "Message", - "code": 6080 - }, - "File '{0}' has an unsupported extension, so skipping it.": { - "category": "Message", - "code": 6081 - }, - "Only 'amd' and 'system' modules are supported alongside --{0}.": { - "category": "Error", - "code": 6082 - }, - "Base directory to resolve non-absolute module names.": { - "category": "Message", - "code": 6083 - }, - "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit": { - "category": "Message", - "code": 6084 - }, - "Enable tracing of the name resolution process.": { - "category": "Message", - "code": 6085 - }, - "======== Resolving module '{0}' from '{1}'. ========": { - "category": "Message", - "code": 6086 - }, - "Explicitly specified module resolution kind: '{0}'.": { - "category": "Message", - "code": 6087 - }, - "Module resolution kind is not specified, using '{0}'.": { - "category": "Message", - "code": 6088 - }, - "======== Module name '{0}' was successfully resolved to '{1}'. ========": { - "category": "Message", - "code": 6089 - }, - "======== Module name '{0}' was not resolved. ========": { - "category": "Message", - "code": 6090 - }, - "'paths' option is specified, looking for a pattern to match module name '{0}'.": { - "category": "Message", - "code": 6091 - }, - "Module name '{0}', matched pattern '{1}'.": { - "category": "Message", - "code": 6092 - }, - "Trying substitution '{0}', candidate module location: '{1}'.": { - "category": "Message", - "code": 6093 - }, - "Resolving module name '{0}' relative to base url '{1}' - '{2}'.": { - "category": "Message", - "code": 6094 - }, - "Loading module as file / folder, candidate module location '{0}', target file type '{1}'.": { - "category": "Message", - "code": 6095 - }, - "File '{0}' does not exist.": { - "category": "Message", - "code": 6096 - }, - "File '{0}' exist - use it as a name resolution result.": { - "category": "Message", - "code": 6097 - }, - "Loading module '{0}' from 'node_modules' folder, target file type '{1}'.": { - "category": "Message", - "code": 6098 - }, - "Found 'package.json' at '{0}'.": { - "category": "Message", - "code": 6099 - }, - "'package.json' does not have a '{0}' field.": { - "category": "Message", - "code": 6100 - }, - "'package.json' has '{0}' field '{1}' that references '{2}'.": { - "category": "Message", - "code": 6101 - }, - "Allow javascript files to be compiled.": { - "category": "Message", - "code": 6102 - }, - "Option '{0}' should have array of strings as a value.": { - "category": "Error", - "code": 6103 - }, - "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'.": { - "category": "Message", - "code": 6104 - }, - "Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'.": { - "category": "Message", - "code": 6105 - }, - "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'.": { - "category": "Message", - "code": 6106 - }, - "'rootDirs' option is set, using it to resolve relative module name '{0}'.": { - "category": "Message", - "code": 6107 - }, - "Longest matching prefix for '{0}' is '{1}'.": { - "category": "Message", - "code": 6108 - }, - "Loading '{0}' from the root dir '{1}', candidate location '{2}'.": { - "category": "Message", - "code": 6109 - }, - "Trying other entries in 'rootDirs'.": { - "category": "Message", - "code": 6110 - }, - "Module resolution using 'rootDirs' has failed.": { - "category": "Message", - "code": 6111 - }, - "Do not emit 'use strict' directives in module output.": { - "category": "Message", - "code": 6112 - }, - "Enable strict null checks.": { - "category": "Message", - "code": 6113 - }, - "Unknown option 'excludes'. Did you mean 'exclude'?": { - "category": "Error", - "code": 6114 - }, - "Raise error on 'this' expressions with an implied 'any' type.": { - "category": "Message", - "code": 6115 - }, - "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========": { - "category": "Message", - "code": 6116 - }, - "Resolving using primary search paths...": { - "category": "Message", - "code": 6117 - }, - "Resolving from node_modules folder...": { - "category": "Message", - "code": 6118 - }, - "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========": { - "category": "Message", - "code": 6119 - }, - "======== Type reference directive '{0}' was not resolved. ========": { - "category": "Message", - "code": 6120 - }, - "Resolving with primary search path '{0}'.": { - "category": "Message", - "code": 6121 - }, - "Root directory cannot be determined, skipping primary search paths.": { - "category": "Message", - "code": 6122 - }, - "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========": { - "category": "Message", - "code": 6123 - }, - "Type declaration files to be included in compilation.": { - "category": "Message", - "code": 6124 - }, - "Looking up in 'node_modules' folder, initial location '{0}'.": { - "category": "Message", - "code": 6125 - }, - "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder.": { - "category": "Message", - "code": 6126 - }, - "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========": { - "category": "Message", - "code": 6127 - }, - "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========": { - "category": "Message", - "code": 6128 - }, - "Resolving real path for '{0}', result '{1}'.": { - "category": "Message", - "code": 6130 - }, - "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'.": { - "category": "Error", - "code": 6131 - }, - "File name '{0}' has a '{1}' extension - stripping it.": { - "category": "Message", - "code": 6132 - }, - "'{0}' is declared but its value is never read.": { - "category": "Error", - "code": 6133, - "reportsUnnecessary": true - }, - "Report errors on unused locals.": { - "category": "Message", - "code": 6134 - }, - "Report errors on unused parameters.": { - "category": "Message", - "code": 6135 - }, - "The maximum dependency depth to search under node_modules and load JavaScript files.": { - "category": "Message", - "code": 6136 - }, - "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'.": { - "category": "Error", - "code": 6137 - }, - "Property '{0}' is declared but its value is never read.": { - "category": "Error", - "code": 6138, - "reportsUnnecessary": true - }, - "Import emit helpers from 'tslib'.": { - "category": "Message", - "code": 6139 - }, - "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'.": { - "category": "Error", - "code": 6140 - }, - "Parse in strict mode and emit \"use strict\" for each source file.": { - "category": "Message", - "code": 6141 - }, - "Module '{0}' was resolved to '{1}', but '--jsx' is not set.": { - "category": "Error", - "code": 6142 - }, - "Module '{0}' was resolved as locally declared ambient module in file '{1}'.": { - "category": "Message", - "code": 6144 - }, - "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified.": { - "category": "Message", - "code": 6145 - }, - "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'.": { - "category": "Message", - "code": 6146 - }, - "Resolution for module '{0}' was found in cache from location '{1}'.": { - "category": "Message", - "code": 6147 - }, - "Directory '{0}' does not exist, skipping all lookups in it.": { - "category": "Message", - "code": 6148 - }, - "Show diagnostic information.": { - "category": "Message", - "code": 6149 - }, - "Show verbose diagnostic information.": { - "category": "Message", - "code": 6150 - }, - "Emit a single file with source maps instead of having a separate file.": { - "category": "Message", - "code": 6151 - }, - "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set.": { - "category": "Message", - "code": 6152 - }, - "Transpile each file as a separate module (similar to 'ts.transpileModule').": { - "category": "Message", - "code": 6153 - }, - "Print names of generated files part of the compilation.": { - "category": "Message", - "code": 6154 - }, - "Print names of files part of the compilation.": { - "category": "Message", - "code": 6155 - }, - "The locale used when displaying messages to the user (e.g. 'en-us')": { - "category": "Message", - "code": 6156 - }, - "Do not generate custom helper functions like '__extends' in compiled output.": { - "category": "Message", - "code": 6157 - }, - "Do not include the default library file (lib.d.ts).": { - "category": "Message", - "code": 6158 - }, - "Do not add triple-slash references or imported modules to the list of compiled files.": { - "category": "Message", - "code": 6159 - }, - "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files.": { - "category": "Message", - "code": 6160 - }, - "List of folders to include type definitions from.": { - "category": "Message", - "code": 6161 - }, - "Disable size limitations on JavaScript projects.": { - "category": "Message", - "code": 6162 - }, - "The character set of the input files.": { - "category": "Message", - "code": 6163 - }, - "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.": { - "category": "Message", - "code": 6164 - }, - "Do not truncate error messages.": { - "category": "Message", - "code": 6165 - }, - "Output directory for generated declaration files.": { - "category": "Message", - "code": 6166 - }, - "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'.": { - "category": "Message", - "code": 6167 - }, - "List of root folders whose combined content represents the structure of the project at runtime.": { - "category": "Message", - "code": 6168 - }, - "Show all compiler options.": { - "category": "Message", - "code": 6169 - }, - "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file": { - "category": "Message", - "code": 6170 - }, - "Command-line Options": { - "category": "Message", - "code": 6171 - }, - "Basic Options": { - "category": "Message", - "code": 6172 - }, - "Strict Type-Checking Options": { - "category": "Message", - "code": 6173 - }, - "Module Resolution Options": { - "category": "Message", - "code": 6174 - }, - "Source Map Options": { - "category": "Message", - "code": 6175 - }, - "Additional Checks": { - "category": "Message", - "code": 6176 - }, - "Experimental Options": { - "category": "Message", - "code": 6177 - }, - "Advanced Options": { - "category": "Message", - "code": 6178 - }, - "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'.": { - "category": "Message", - "code": 6179 - }, - "Enable all strict type-checking options.": { - "category": "Message", - "code": 6180 - }, - "List of language service plugins.": { - "category": "Message", - "code": 6181 - }, - "Scoped package detected, looking in '{0}'": { - "category": "Message", - "code": 6182 - }, - "Reusing resolution of module '{0}' to file '{1}' from old program.": { - "category": "Message", - "code": 6183 - }, - "Reusing module resolutions originating in '{0}' since resolutions are unchanged from old program.": { - "category": "Message", - "code": 6184 - }, - "Disable strict checking of generic signatures in function types.": { - "category": "Message", - "code": 6185 - }, - "Enable strict checking of function types.": { - "category": "Message", - "code": 6186 - }, - "Enable strict checking of property initialization in classes.": { - "category": "Message", - "code": 6187 - }, - "Numeric separators are not allowed here.": { - "category": "Error", - "code": 6188 - }, - "Multiple consecutive numeric separators are not permitted.": { - "category": "Error", - "code": 6189 - }, - "Whether to keep outdated console output in watch mode instead of clearing the screen.": { - "category": "Message", - "code": 6191 - }, - "All imports in import declaration are unused.": { - "category": "Error", - "code": 6192, - "reportsUnnecessary": true - }, - "Found 1 error. Watching for file changes.": { - "category": "Message", - "code": 6193 - }, - "Found {0} errors. Watching for file changes.": { - "category": "Message", - "code": 6194 - }, - "Resolve 'keyof' to string valued property names only (no numbers or symbols).": { - "category": "Message", - "code": 6195 - }, - "'{0}' is declared but never used.": { - "category": "Error", - "code": 6196, - "reportsUnnecessary": true - }, - "Include modules imported with '.json' extension": { - "category": "Message", - "code": 6197 - }, - "All destructured elements are unused.": { - "category": "Error", - "code": 6198, - "reportsUnnecessary": true - }, - "All variables are unused.": { - "category": "Error", - "code": 6199, - "reportsUnnecessary": true - }, - "Definitions of the following identifiers conflict with those in another file: {0}": { - "category": "Error", - "code": 6200 - }, - "Conflicts are in this file.": { - "category": "Message", - "code": 6201 - }, - "Project references may not form a circular graph. Cycle detected: {0}": { - "category": "Error", - "code": 6202 - }, - "'{0}' was also declared here.": { - "category": "Message", - "code": 6203 - }, - "and here.": { - "category": "Message", - "code": 6204 - }, - "All type parameters are unused.": { - "category": "Error", - "code": 6205 - }, - "'package.json' has a 'typesVersions' field with version-specific path mappings.": { - "category": "Message", - "code": 6206 - }, - "'package.json' does not have a 'typesVersions' entry that matches version '{0}'.": { - "category": "Message", - "code": 6207 - }, - "'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'.": { - "category": "Message", - "code": 6208 - }, - "'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range.": { - "category": "Message", - "code": 6209 - }, - "An argument for '{0}' was not provided.": { - "category": "Message", - "code": 6210 - }, - "An argument matching this binding pattern was not provided.": { - "category": "Message", - "code": 6211 - }, - "Did you mean to call this expression?": { - "category": "Message", - "code": 6212 - }, - "Did you mean to use 'new' with this expression?": { - "category": "Message", - "code": 6213 - }, - "Enable strict 'bind', 'call', and 'apply' methods on functions.": { - "category": "Message", - "code": 6214 - }, - "Using compiler options of project reference redirect '{0}'.": { - "category": "Message", - "code": 6215 - }, - "Found 1 error.": { - "category": "Message", - "code": 6216 - }, - "Found {0} errors.": { - "category": "Message", - "code": 6217 - }, - "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========": { - "category": "Message", - "code": 6218 - }, - "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========": { - "category": "Message", - "code": 6219 - }, - "'package.json' had a falsy '{0}' field.": { - "category": "Message", - "code": 6220 - }, - "Disable use of source files instead of declaration files from referenced projects.": { - "category": "Message", - "code": 6221 - }, - "Emit class fields with Define instead of Set.": { - "category": "Message", - "code": 6222 - }, - "Generates a CPU profile.": { - "category": "Message", - "code": 6223 - }, - "Disable solution searching for this project.": { - "category": "Message", - "code": 6224 - }, - "Specify strategy for watching file: 'FixedPollingInterval' (default), 'PriorityPollingInterval', 'DynamicPriorityPolling', 'UseFsEvents', 'UseFsEventsOnParentDirectory'.": { - "category": "Message", - "code": 6225 - }, - "Specify strategy for watching directory on platforms that don't support recursive watching natively: 'UseFsEvents' (default), 'FixedPollingInterval', 'DynamicPriorityPolling'.": { - "category": "Message", - "code": 6226 - }, - "Specify strategy for creating a polling watch when it fails to create using file system events: 'FixedInterval' (default), 'PriorityInterval', 'DynamicPriority'.": { - "category": "Message", - "code": 6227 - }, - "Synchronously call callbacks and update the state of directory watchers on platforms that don't support recursive watching natively.": { - "category": "Message", - "code": 6228 - }, - "Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'.": { - "category": "Error", - "code": 6229 - }, - "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'false' or 'null' on command line.": { - "category": "Error", - "code": 6230 - }, - "Could not resolve the path '{0}' with the extensions: {1}.": { - "category": "Error", - "code": 6231 - }, - "Declaration augments declaration in another file. This cannot be serialized.": { - "category": "Error", - "code": 6232 - }, - "This is the declaration being augmented. Consider moving the augmenting declaration into the same file.": { - "category": "Error", - "code": 6233 - }, - "This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?": { - "category": "Error", - "code": 6234 - }, - "Disable loading referenced projects.": { - "category": "Message", - "code": 6235 - }, - "Arguments for the rest parameter '{0}' were not provided.": { - "category": "Error", - "code": 6236 - }, - "Generates an event trace and a list of types.": { - "category": "Message", - "code": 6237 - }, - "Specify the module specifier to be used to import the `jsx` and `jsxs` factory functions from. eg, react": { - "category": "Error", - "code": 6238 - }, - - "Projects to reference": { - "category": "Message", - "code": 6300 - }, - "Enable project compilation": { - "category": "Message", - "code": 6302 - }, - - "Composite projects may not disable declaration emit.": { - "category": "Error", - "code": 6304 - }, - "Output file '{0}' has not been built from source file '{1}'.": { - "category": "Error", - "code": 6305 - }, - "Referenced project '{0}' must have setting \"composite\": true.": { - "category": "Error", - "code": 6306 - }, - "File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern.": { - "category": "Error", - "code": 6307 - }, - "Cannot prepend project '{0}' because it does not have 'outFile' set": { - "category": "Error", - "code": 6308 - }, - "Output file '{0}' from project '{1}' does not exist": { - "category": "Error", - "code": 6309 - }, - "Referenced project '{0}' may not disable emit.": { - "category": "Error", - "code": 6310 - }, - "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'": { - "category": "Message", - "code": 6350 - }, - "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'": { - "category": "Message", - "code": 6351 - }, - "Project '{0}' is out of date because output file '{1}' does not exist": { - "category": "Message", - "code": 6352 - }, - "Project '{0}' is out of date because its dependency '{1}' is out of date": { - "category": "Message", - "code": 6353 - }, - "Project '{0}' is up to date with .d.ts files from its dependencies": { - "category": "Message", - "code": 6354 - }, - "Projects in this build: {0}": { - "category": "Message", - "code": 6355 - }, - "A non-dry build would delete the following files: {0}": { - "category": "Message", - "code": 6356 - }, - "A non-dry build would build project '{0}'": { - "category": "Message", - "code": 6357 - }, - "Building project '{0}'...": { - "category": "Message", - "code": 6358 - }, - "Updating output timestamps of project '{0}'...": { - "category": "Message", - "code": 6359 - }, - "delete this - Project '{0}' is up to date because it was previously built": { - "category": "Message", - "code": 6360 - }, - "Project '{0}' is up to date": { - "category": "Message", - "code": 6361 - }, - "Skipping build of project '{0}' because its dependency '{1}' has errors": { - "category": "Message", - "code": 6362 - }, - "Project '{0}' can't be built because its dependency '{1}' has errors": { - "category": "Message", - "code": 6363 - }, - "Build one or more projects and their dependencies, if out of date": { - "category": "Message", - "code": 6364 - }, - "Delete the outputs of all projects": { - "category": "Message", - "code": 6365 - }, - "Enable verbose logging": { - "category": "Message", - "code": 6366 - }, - "Show what would be built (or deleted, if specified with '--clean')": { - "category": "Message", - "code": 6367 - }, - "Build all projects, including those that appear to be up to date": { - "category": "Message", - "code": 6368 - }, - "Option '--build' must be the first command line argument.": { - "category": "Error", - "code": 6369 - }, - "Options '{0}' and '{1}' cannot be combined.": { - "category": "Error", - "code": 6370 - }, - "Updating unchanged output timestamps of project '{0}'...": { - "category": "Message", - "code": 6371 - }, - "Project '{0}' is out of date because output of its dependency '{1}' has changed": { - "category": "Message", - "code": 6372 - }, - "Updating output of project '{0}'...": { - "category": "Message", - "code": 6373 - }, - "A non-dry build would update timestamps for output of project '{0}'": { - "category": "Message", - "code": 6374 - }, - "A non-dry build would update output of project '{0}'": { - "category": "Message", - "code": 6375 - }, - "Cannot update output of project '{0}' because there was error reading file '{1}'": { - "category": "Message", - "code": 6376 - }, - "Cannot write file '{0}' because it will overwrite '.tsbuildinfo' file generated by referenced project '{1}'": { - "category": "Error", - "code": 6377 - }, - "Enable incremental compilation": { - "category": "Message", - "code": 6378 - }, - "Composite projects may not disable incremental compilation.": { - "category": "Error", - "code": 6379 - }, - "Specify file to store incremental compilation information": { - "category": "Message", - "code": 6380 - }, - "Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'": { - "category": "Message", - "code": 6381 - }, - "Skipping build of project '{0}' because its dependency '{1}' was not built": { - "category": "Message", - "code": 6382 - }, - "Project '{0}' can't be built because its dependency '{1}' was not built": { - "category": "Message", - "code": 6383 - }, - "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.": { - "category": "Message", - "code": 6384 - }, - "'{0}' is deprecated": { - "category": "Suggestion", - "code": 6385, - "reportsDeprecated": true - }, - "Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found.": { - "category": "Message", - "code": 6386 - }, - - "The expected type comes from property '{0}' which is declared here on type '{1}'": { - "category": "Message", - "code": 6500 - }, - "The expected type comes from this index signature.": { - "category": "Message", - "code": 6501 - }, - "The expected type comes from the return type of this signature.": { - "category": "Message", - "code": 6502 - }, - "Print names of files that are part of the compilation and then stop processing.": { - "category": "Message", - "code": 6503 - }, - "File '{0}' is a JavaScript file. Did you mean to enable the 'allowJs' option?": { - "category": "Error", - "code": 6504 - }, - "Print names of files and the reason they are part of the compilation.": { - "category": "Message", - "code": 6505 - }, - "Require undeclared properties from index signatures to use element accesses.": { - "category": "Error", - "code": 6803 - }, - - "Include 'undefined' in index signature results": { - "category": "Message", - "code": 6800 - }, - "Force overriding members in derived classes to be marked with an 'override' modifier.": { - "category": "Error", - "code": 6801 - }, - "Require undeclared properties from index signatures to use element accesses.": { - "category": "Error", - "code": 6803 - }, - - "Variable '{0}' implicitly has an '{1}' type.": { - "category": "Error", - "code": 7005 - }, - "Parameter '{0}' implicitly has an '{1}' type.": { - "category": "Error", - "code": 7006 - }, - "Member '{0}' implicitly has an '{1}' type.": { - "category": "Error", - "code": 7008 - }, - "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.": { - "category": "Error", - "code": 7009 - }, - "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type.": { - "category": "Error", - "code": 7010 - }, - "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type.": { - "category": "Error", - "code": 7011 - }, - "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.": { - "category": "Error", - "code": 7013 - }, - "Function type, which lacks return-type annotation, implicitly has an '{0}' return type.": { - "category": "Error", - "code": 7014 - }, - "Element implicitly has an 'any' type because index expression is not of type 'number'.": { - "category": "Error", - "code": 7015 - }, - "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type.": { - "category": "Error", - "code": 7016 - }, - "Element implicitly has an 'any' type because type '{0}' has no index signature.": { - "category": "Error", - "code": 7017 - }, - "Object literal's property '{0}' implicitly has an '{1}' type.": { - "category": "Error", - "code": 7018 - }, - "Rest parameter '{0}' implicitly has an 'any[]' type.": { - "category": "Error", - "code": 7019 - }, - "Call signature, which lacks return-type annotation, implicitly has an 'any' return type.": { - "category": "Error", - "code": 7020 - }, - "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.": { - "category": "Error", - "code": 7022 - }, - "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.": { - "category": "Error", - "code": 7023 - }, - "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.": { - "category": "Error", - "code": 7024 - }, - "Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation.": { - "category": "Error", - "code": 7025 - }, - "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists.": { - "category": "Error", - "code": 7026 - }, - "Unreachable code detected.": { - "category": "Error", - "code": 7027, - "reportsUnnecessary": true - }, - "Unused label.": { - "category": "Error", - "code": 7028, - "reportsUnnecessary": true - }, - "Fallthrough case in switch.": { - "category": "Error", - "code": 7029 - }, - "Not all code paths return a value.": { - "category": "Error", - "code": 7030 - }, - "Binding element '{0}' implicitly has an '{1}' type.": { - "category": "Error", - "code": 7031 - }, - "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation.": { - "category": "Error", - "code": 7032 - }, - "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation.": { - "category": "Error", - "code": 7033 - }, - "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined.": { - "category": "Error", - "code": 7034 - }, - "Try `npm i --save-dev @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`": { - "category": "Error", - "code": 7035 - }, - "Dynamic import's specifier must be of type 'string', but here has type '{0}'.": { - "category": "Error", - "code": 7036 - }, - "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'.": { - "category": "Message", - "code": 7037 - }, - "Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.": { - "category": "Message", - "code": 7038 - }, - "Mapped object type implicitly has an 'any' template type.": { - "category": "Error", - "code": 7039 - }, - "If the '{0}' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/{1}`": { - "category": "Error", - "code": 7040 - }, - "The containing arrow function captures the global value of 'this'.": { - "category": "Error", - "code": 7041 - }, - "Module '{0}' was resolved to '{1}', but '--resolveJsonModule' is not used.": { - "category": "Error", - "code": 7042 - }, - "Variable '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage.": { - "category": "Suggestion", - "code": 7043 - }, - "Parameter '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage.": { - "category": "Suggestion", - "code": 7044 - }, - "Member '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage.": { - "category": "Suggestion", - "code": 7045 - }, - "Variable '{0}' implicitly has type '{1}' in some locations, but a better type may be inferred from usage.": { - "category": "Suggestion", - "code": 7046 - }, - "Rest parameter '{0}' implicitly has an 'any[]' type, but a better type may be inferred from usage.": { - "category": "Suggestion", - "code": 7047 - }, - "Property '{0}' implicitly has type 'any', but a better type for its get accessor may be inferred from usage.": { - "category": "Suggestion", - "code": 7048 - }, - "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage.": { - "category": "Suggestion", - "code": 7049 - }, - "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage.": { - "category": "Suggestion", - "code": 7050 - }, - "Parameter has a name but no type. Did you mean '{0}: {1}'?": { - "category": "Error", - "code": 7051 - }, - "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}'?": { - "category": "Error", - "code": 7052 - }, - "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'.": { - "category": "Error", - "code": 7053 - }, - "No index signature with a parameter of type '{0}' was found on type '{1}'.": { - "category": "Error", - "code": 7054 - }, - "'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type.": { - "category": "Error", - "code": 7055 - }, - "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.": { - "category": "Error", - "code": 7056 - }, - "'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation.": { - "category": "Error", - "code": 7057 - }, - - "You cannot rename this element.": { - "category": "Error", - "code": 8000 - }, - "You cannot rename elements that are defined in the standard TypeScript library.": { - "category": "Error", - "code": 8001 - }, - "'import ... =' can only be used in TypeScript files.": { - "category": "Error", - "code": 8002 - }, - "'export =' can only be used in TypeScript files.": { - "category": "Error", - "code": 8003 - }, - "Type parameter declarations can only be used in TypeScript files.": { - "category": "Error", - "code": 8004 - }, - "'implements' clauses can only be used in TypeScript files.": { - "category": "Error", - "code": 8005 - }, - "'{0}' declarations can only be used in TypeScript files.": { - "category": "Error", - "code": 8006 - }, - "Type aliases can only be used in TypeScript files.": { - "category": "Error", - "code": 8008 - }, - "The '{0}' modifier can only be used in TypeScript files.": { - "category": "Error", - "code": 8009 - }, - "Type annotations can only be used in TypeScript files.": { - "category": "Error", - "code": 8010 - }, - "Type arguments can only be used in TypeScript files.": { - "category": "Error", - "code": 8011 - }, - "Parameter modifiers can only be used in TypeScript files.": { - "category": "Error", - "code": 8012 - }, - "Non-null assertions can only be used in TypeScript files.": { - "category": "Error", - "code": 8013 - }, - "Type assertion expressions can only be used in TypeScript files.": { - "category": "Error", - "code": 8016 - }, - "Octal literal types must use ES2015 syntax. Use the syntax '{0}'.": { - "category": "Error", - "code": 8017 - }, - "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'.": { - "category": "Error", - "code": 8018 - }, - "Report errors in .js files.": { - "category": "Message", - "code": 8019 - }, - "JSDoc types can only be used inside documentation comments.": { - "category": "Error", - "code": 8020 - }, - "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags.": { - "category": "Error", - "code": 8021 - }, - "JSDoc '@{0}' is not attached to a class.": { - "category": "Error", - "code": 8022 - }, - "JSDoc '@{0} {1}' does not match the 'extends {2}' clause.": { - "category": "Error", - "code": 8023 - }, - "JSDoc '@param' tag has name '{0}', but there is no parameter with that name.": { - "category": "Error", - "code": 8024 - }, - "Class declarations cannot have more than one `@augments` or `@extends` tag.": { - "category": "Error", - "code": 8025 - }, - "Expected {0} type arguments; provide these with an '@extends' tag.": { - "category": "Error", - "code": 8026 - }, - "Expected {0}-{1} type arguments; provide these with an '@extends' tag.": { - "category": "Error", - "code": 8027 - }, - "JSDoc '...' may only appear in the last parameter of a signature.": { - "category": "Error", - "code": 8028 - }, - "JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type.": { - "category": "Error", - "code": 8029 - }, - "The type of a function declaration must match the function's signature.": { - "category": "Error", - "code": 8030 - }, - "You cannot rename a module via a global import.": { - "category": "Error", - "code": 8031 - }, - "Qualified name '{0}' is not allowed without a leading '@param {object} {1}'.": { - "category": "Error", - "code": 8032 - }, - "A JSDoc '@typedef' comment may not contain multiple '@type' tags.": { - "category": "Error", - "code": 8033 - }, - "The tag was first specified here.": { - "category": "Error", - "code": 8034 - }, - "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": { - "category": "Error", - "code": 9002 - }, - "'class' expressions are not currently supported.": { - "category": "Error", - "code": 9003 - }, - "Language service is disabled.": { - "category": "Error", - "code": 9004 - }, - "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.": { - "category": "Error", - "code": 9005 - }, - "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit.": { - "category": "Error", - "code": 9006 - }, - "JSX attributes must only be assigned a non-empty 'expression'.": { - "category": "Error", - "code": 17000 - }, - "JSX elements cannot have multiple attributes with the same name.": { - "category": "Error", - "code": 17001 - }, - "Expected corresponding JSX closing tag for '{0}'.": { - "category": "Error", - "code": 17002 - }, - "JSX attribute expected.": { - "category": "Error", - "code": 17003 - }, - "Cannot use JSX unless the '--jsx' flag is provided.": { - "category": "Error", - "code": 17004 - }, - "A constructor cannot contain a 'super' call when its class extends 'null'.": { - "category": "Error", - "code": 17005 - }, - "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": { - "category": "Error", - "code": 17006 - }, - "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": { - "category": "Error", - "code": 17007 - }, - "JSX element '{0}' has no corresponding closing tag.": { - "category": "Error", - "code": 17008 - }, - "'super' must be called before accessing 'this' in the constructor of a derived class.": { - "category": "Error", - "code": 17009 - }, - "Unknown type acquisition option '{0}'.": { - "category": "Error", - "code": 17010 - }, - "'super' must be called before accessing a property of 'super' in the constructor of a derived class.": { - "category": "Error", - "code": 17011 - }, - "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?": { - "category": "Error", - "code": 17012 - }, - "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor.": { - "category": "Error", - "code": 17013 - }, - "JSX fragment has no corresponding closing tag.": { - "category": "Error", - "code": 17014 - }, - "Expected corresponding closing tag for JSX fragment.": { - "category": "Error", - "code": 17015 - }, - "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.": { - "category": "Error", - "code": 17016 - }, - "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.": { - "category": "Error", - "code": 17017 - }, - "Unknown type acquisition option '{0}'. Did you mean '{1}'?": { - "category": "Error", - "code": 17018 - }, - "Circularity detected while resolving configuration: {0}": { - "category": "Error", - "code": 18000 - }, - "A path in an 'extends' option must be relative or rooted, but '{0}' is not.": { - "category": "Error", - "code": 18001 - }, - "The 'files' list in config file '{0}' is empty.": { - "category": "Error", - "code": 18002 - }, - "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'.": { - "category": "Error", - "code": 18003 - }, - - "File is a CommonJS module; it may be converted to an ES6 module.": { - "category": "Suggestion", - "code": 80001 - }, - "This constructor function may be converted to a class declaration.": { - "category": "Suggestion", - "code": 80002 - }, - "Import may be converted to a default import.": { - "category": "Suggestion", - "code": 80003 - }, - "JSDoc types may be moved to TypeScript types.": { - "category": "Suggestion", - "code": 80004 - }, - "'require' call may be converted to an import.": { - "category": "Suggestion", - "code": 80005 - }, - "This may be converted to an async function.": { - "category": "Suggestion", - "code": 80006 - }, - "'await' has no effect on the type of this expression.": { - "category": "Suggestion", - "code": 80007 - }, - "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers.": { - "category": "Suggestion", - "code": 80008 - }, - - "Add missing 'super()' call": { - "category": "Message", - "code": 90001 - }, - "Make 'super()' call the first statement in the constructor": { - "category": "Message", - "code": 90002 - }, - "Change 'extends' to 'implements'": { - "category": "Message", - "code": 90003 - }, - "Remove unused declaration for: '{0}'": { - "category": "Message", - "code": 90004 - }, - "Remove import from '{0}'": { - "category": "Message", - "code": 90005 - }, - "Implement interface '{0}'": { - "category": "Message", - "code": 90006 - }, - "Implement inherited abstract class": { - "category": "Message", - "code": 90007 - }, - "Add '{0}.' to unresolved variable": { - "category": "Message", - "code": 90008 - }, - "Remove variable statement": { - "category": "Message", - "code": 90010 - }, - "Remove template tag": { - "category": "Message", - "code": 90011 - }, - "Remove type parameters": { - "category": "Message", - "code": 90012 - }, - "Import '{0}' from module \"{1}\"": { - "category": "Message", - "code": 90013 - }, - "Change '{0}' to '{1}'": { - "category": "Message", - "code": 90014 - }, - "Add '{0}' to existing import declaration from \"{1}\"": { - "category": "Message", - "code": 90015 - }, - "Declare property '{0}'": { - "category": "Message", - "code": 90016 - }, - "Add index signature for property '{0}'": { - "category": "Message", - "code": 90017 - }, - "Disable checking for this file": { - "category": "Message", - "code": 90018 - }, - "Ignore this error message": { - "category": "Message", - "code": 90019 - }, - "Initialize property '{0}' in the constructor": { - "category": "Message", - "code": 90020 - }, - "Initialize static property '{0}'": { - "category": "Message", - "code": 90021 - }, - "Change spelling to '{0}'": { - "category": "Message", - "code": 90022 - }, - "Declare method '{0}'": { - "category": "Message", - "code": 90023 - }, - "Declare static method '{0}'": { - "category": "Message", - "code": 90024 - }, - "Prefix '{0}' with an underscore": { - "category": "Message", - "code": 90025 - }, - "Rewrite as the indexed access type '{0}'": { - "category": "Message", - "code": 90026 - }, - "Declare static property '{0}'": { - "category": "Message", - "code": 90027 - }, - "Call decorator expression": { - "category": "Message", - "code": 90028 - }, - "Add async modifier to containing function": { - "category": "Message", - "code": 90029 - }, - "Replace 'infer {0}' with 'unknown'": { - "category": "Message", - "code": 90030 - }, - "Replace all unused 'infer' with 'unknown'": { - "category": "Message", - "code": 90031 - }, - "Import default '{0}' from module \"{1}\"": { - "category": "Message", - "code": 90032 - }, - "Add default import '{0}' to existing import declaration from \"{1}\"": { - "category": "Message", - "code": 90033 - }, - "Add parameter name": { - "category": "Message", - "code": 90034 - }, - "Declare private property '{0}'": { - "category": "Message", - "code": 90035 - }, - "Replace '{0}' with 'Promise<{1}>'": { - "category": "Message", - "code": 90036 - }, - "Fix all incorrect return type of an async functions": { - "category": "Message", - "code": 90037 - }, - "Declare private method '{0}'": { - "category": "Message", - "code": 90038 - }, - "Remove unused destructuring declaration": { - "category": "Message", - "code": 90039 - }, - "Remove unused declarations for: '{0}'": { - "category": "Message", - "code": 90041 - }, - "Declare a private field named '{0}'.": { - "category": "Message", - "code": 90053 - }, - "Convert function to an ES2015 class": { - "category": "Message", - "code": 95001 - }, - "Convert function '{0}' to class": { - "category": "Message", - "code": 95002 - }, - "Convert '{0}' to '{1} in {0}'": { - "category": "Message", - "code": 95003 - }, - "Extract to {0} in {1}": { - "category": "Message", - "code": 95004 - }, - "Extract function": { - "category": "Message", - "code": 95005 - }, - "Extract constant": { - "category": "Message", - "code": 95006 - }, - "Extract to {0} in enclosing scope": { - "category": "Message", - "code": 95007 - }, - "Extract to {0} in {1} scope": { - "category": "Message", - "code": 95008 - }, - "Annotate with type from JSDoc": { - "category": "Message", - "code": 95009 - }, - "Annotate with types from JSDoc": { - "category": "Message", - "code": 95010 - }, - "Infer type of '{0}' from usage": { - "category": "Message", - "code": 95011 - }, - "Infer parameter types from usage": { - "category": "Message", - "code": 95012 - }, - "Convert to default import": { - "category": "Message", - "code": 95013 - }, - "Install '{0}'": { - "category": "Message", - "code": 95014 - }, - "Replace import with '{0}'.": { - "category": "Message", - "code": 95015 - }, - "Use synthetic 'default' member.": { - "category": "Message", - "code": 95016 - }, - "Convert to ES6 module": { - "category": "Message", - "code": 95017 - }, - "Add 'undefined' type to property '{0}'": { - "category": "Message", - "code": 95018 - }, - "Add initializer to property '{0}'": { - "category": "Message", - "code": 95019 - }, - "Add definite assignment assertion to property '{0}'": { - "category": "Message", - "code": 95020 - }, - "Convert all type literals to mapped type": { - "category": "Message", - "code": 95021 - }, - "Add all missing members": { - "category": "Message", - "code": 95022 - }, - "Infer all types from usage": { - "category": "Message", - "code": 95023 - }, - "Delete all unused declarations": { - "category": "Message", - "code": 95024 - }, - "Prefix all unused declarations with '_' where possible": { - "category": "Message", - "code": 95025 - }, - "Fix all detected spelling errors": { - "category": "Message", - "code": 95026 - }, - "Add initializers to all uninitialized properties": { - "category": "Message", - "code": 95027 - }, - "Add definite assignment assertions to all uninitialized properties": { - "category": "Message", - "code": 95028 - }, - "Add undefined type to all uninitialized properties": { - "category": "Message", - "code": 95029 - }, - "Change all jsdoc-style types to TypeScript": { - "category": "Message", - "code": 95030 - }, - "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)": { - "category": "Message", - "code": 95031 - }, - "Implement all unimplemented interfaces": { - "category": "Message", - "code": 95032 - }, - "Install all missing types packages": { - "category": "Message", - "code": 95033 - }, - "Rewrite all as indexed access types": { - "category": "Message", - "code": 95034 - }, - "Convert all to default imports": { - "category": "Message", - "code": 95035 - }, - "Make all 'super()' calls the first statement in their constructor": { - "category": "Message", - "code": 95036 - }, - "Add qualifier to all unresolved variables matching a member name": { - "category": "Message", - "code": 95037 - }, - "Change all extended interfaces to 'implements'": { - "category": "Message", - "code": 95038 - }, - "Add all missing super calls": { - "category": "Message", - "code": 95039 - }, - "Implement all inherited abstract classes": { - "category": "Message", - "code": 95040 - }, - "Add all missing 'async' modifiers": { - "category": "Message", - "code": 95041 - }, - "Add '@ts-ignore' to all error messages": { - "category": "Message", - "code": 95042 - }, - "Annotate everything with types from JSDoc": { - "category": "Message", - "code": 95043 - }, - "Add '()' to all uncalled decorators": { - "category": "Message", - "code": 95044 - }, - "Convert all constructor functions to classes": { - "category": "Message", - "code": 95045 - }, - "Generate 'get' and 'set' accessors": { - "category": "Message", - "code": 95046 - }, - "Convert 'require' to 'import'": { - "category": "Message", - "code": 95047 - }, - "Convert all 'require' to 'import'": { - "category": "Message", - "code": 95048 - }, - "Move to a new file": { - "category": "Message", - "code": 95049 - }, - "Remove unreachable code": { - "category": "Message", - "code": 95050 - }, - "Remove all unreachable code": { - "category": "Message", - "code": 95051 - }, - "Add missing 'typeof'": { - "category": "Message", - "code": 95052 - }, - "Remove unused label": { - "category": "Message", - "code": 95053 - }, - "Remove all unused labels": { - "category": "Message", - "code": 95054 - }, - "Convert '{0}' to mapped object type": { - "category": "Message", - "code": 95055 - }, - "Convert namespace import to named imports": { - "category": "Message", - "code": 95056 - }, - "Convert named imports to namespace import": { - "category": "Message", - "code": 95057 - }, - "Add or remove braces in an arrow function": { - "category": "Message", - "code": 95058 - }, - "Add braces to arrow function": { - "category": "Message", - "code": 95059 - }, - "Remove braces from arrow function": { - "category": "Message", - "code": 95060 - }, - "Convert default export to named export": { - "category": "Message", - "code": 95061 - }, - "Convert named export to default export": { - "category": "Message", - "code": 95062 - }, - "Add missing enum member '{0}'": { - "category": "Message", - "code": 95063 - }, - "Add all missing imports": { - "category": "Message", - "code": 95064 - }, - "Convert to async function": { - "category": "Message", - "code": 95065 - }, - "Convert all to async functions": { - "category": "Message", - "code": 95066 - }, - "Add missing call parentheses": { - "category": "Message", - "code": 95067 - }, - "Add all missing call parentheses": { - "category": "Message", - "code": 95068 - }, - "Add 'unknown' conversion for non-overlapping types": { - "category": "Message", - "code": 95069 - }, - "Add 'unknown' to all conversions of non-overlapping types": { - "category": "Message", - "code": 95070 - }, - "Add missing 'new' operator to call": { - "category": "Message", - "code": 95071 - }, - "Add missing 'new' operator to all calls": { - "category": "Message", - "code": 95072 - }, - "Add names to all parameters without names": { - "category": "Message", - "code": 95073 - }, - "Enable the 'experimentalDecorators' option in your configuration file": { - "category": "Message", - "code": 95074 - }, - "Convert parameters to destructured object": { - "category": "Message", - "code": 95075 - }, - "Allow accessing UMD globals from modules.": { - "category": "Message", - "code": 95076 - }, - "Extract type": { - "category": "Message", - "code": 95077 - }, - "Extract to type alias": { - "category": "Message", - "code": 95078 - }, - "Extract to typedef": { - "category": "Message", - "code": 95079 - }, - "Infer 'this' type of '{0}' from usage": { - "category": "Message", - "code": 95080 - }, - "Add 'const' to unresolved variable": { - "category": "Message", - "code": 95081 - }, - "Add 'const' to all unresolved variables": { - "category": "Message", - "code": 95082 - }, - "Add 'await'": { - "category": "Message", - "code": 95083 - }, - "Add 'await' to initializer for '{0}'": { - "category": "Message", - "code": 95084 - }, - "Fix all expressions possibly missing 'await'": { - "category": "Message", - "code": 95085 - }, - "Remove unnecessary 'await'": { - "category": "Message", - "code": 95086 - }, - "Remove all unnecessary uses of 'await'": { - "category": "Message", - "code": 95087 - }, - "Enable the '--jsx' flag in your configuration file": { - "category": "Message", - "code": 95088 - }, - "Add 'await' to initializers": { - "category": "Message", - "code": 95089 - }, - "Extract to interface": { - "category": "Message", - "code": 95090 - }, - "Convert to a bigint numeric literal": { - "category": "Message", - "code": 95091 - }, - "Convert all to bigint numeric literals": { - "category": "Message", - "code": 95092 - }, - "Convert 'const' to 'let'": { - "category": "Message", - "code": 95093 - }, - "Prefix with 'declare'": { - "category": "Message", - "code": 95094 - }, - "Prefix all incorrect property declarations with 'declare'": { - "category": "Message", - "code": 95095 - }, - "Convert to template string": { - "category": "Message", - "code": 95096 - }, - "Add 'export {}' to make this file into a module": { - "category": "Message", - "code": 95097 - }, - "Set the 'target' option in your configuration file to '{0}'": { - "category": "Message", - "code": 95098 - }, - "Set the 'module' option in your configuration file to '{0}'": { - "category": "Message", - "code": 95099 - }, - "Convert invalid character to its html entity code": { - "category": "Message", - "code": 95100 - }, - "Convert all invalid characters to HTML entity code": { - "category": "Message", - "code": 95101 - }, - "Add '@class' tag": { - "category": "Message", - "code": 95102 - }, - "Add '@this' tag": { - "category": "Message", - "code": 95103 - }, - "Add 'this' parameter.": { - "category": "Message", - "code": 95104 - }, - "Convert function expression '{0}' to arrow function": { - "category": "Message", - "code": 95105 - }, - "Convert function declaration '{0}' to arrow function": { - "category": "Message", - "code": 95106 - }, - "Fix all implicit-'this' errors": { - "category": "Message", - "code": 95107 - }, - "Wrap invalid character in an expression container": { - "category": "Message", - "code": 95108 - }, - "Wrap all invalid characters in an expression container": { - "category": "Message", - "code": 95109 - }, - "Visit https://aka.ms/tsconfig.json to read more about this file": { - "category": "Message", - "code": 95110 - }, - "Add a return statement": { - "category": "Message", - "code": 95111 - }, - "Remove braces from arrow function body": { - "category": "Message", - "code": 95112 - }, - "Wrap the following body with parentheses which should be an object literal": { - "category": "Message", - "code": 95113 - }, - "Add all missing return statement": { - "category": "Message", - "code": 95114 - }, - "Remove braces from all arrow function bodies with relevant issues": { - "category": "Message", - "code": 95115 - }, - "Wrap all object literal with parentheses": { - "category": "Message", - "code": 95116 - }, - "Move labeled tuple element modifiers to labels": { - "category": "Message", - "code": 95117 - }, - "Convert overload list to single signature": { - "category": "Message", - "code": 95118 - }, - "Generate 'get' and 'set' accessors for all overriding properties": { - "category": "Message", - "code": 95119 - }, - "Wrap in JSX fragment": { - "category": "Message", - "code": 95120 - }, - "Wrap all unparented JSX in JSX fragment": { - "category": "Message", - "code": 95121 - }, - "Convert arrow function or function expression": { - "category": "Message", - "code": 95122 - }, - "Convert to anonymous function": { - "category": "Message", - "code": 95123 - }, - "Convert to named function": { - "category": "Message", - "code": 95124 - }, - "Convert to arrow function": { - "category": "Message", - "code": 95125 - }, - "Remove parentheses": { - "category": "Message", - "code": 95126 - }, - "Could not find a containing arrow function": { - "category": "Message", - "code": 95127 - }, - "Containing function is not an arrow function": { - "category": "Message", - "code": 95128 - }, - "Could not find export statement": { - "category": "Message", - "code": 95129 - }, - "This file already has a default export": { - "category": "Message", - "code": 95130 - }, - "Could not find import clause": { - "category": "Message", - "code": 95131 - }, - "Could not find namespace import or named imports": { - "category": "Message", - "code": 95132 - }, - "Selection is not a valid type node": { - "category": "Message", - "code": 95133 - }, - "No type could be extracted from this type node": { - "category": "Message", - "code": 95134 - }, - "Could not find property for which to generate accessor": { - "category": "Message", - "code": 95135 - }, - "Name is not valid": { - "category": "Message", - "code": 95136 - }, - "Can only convert property with modifier": { - "category": "Message", - "code": 95137 - }, - "Switch each misused '{0}' to '{1}'": { - "category": "Message", - "code": 95138 - }, - "Convert to optional chain expression": { - "category": "Message", - "code": 95139 - }, - "Could not find convertible access expression": { - "category": "Message", - "code": 95140 - }, - "Could not find matching access expressions": { - "category": "Message", - "code": 95141 - }, - "Can only convert logical AND access chains": { - "category": "Message", - "code": 95142 - }, - "Add 'void' to Promise resolved without a value": { - "category": "Message", - "code": 95143 - }, - "Add 'void' to all Promises resolved without a value": { - "category": "Message", - "code": 95144 - }, - - "Use element access for '{0}'": { - "category": "Message", - "code": 95145 - }, - "Use element access for all undeclared properties.": { - "category": "Message", - "code": 95146 - }, - "Delete all unused imports": { - "category": "Message", - "code": 95147 - }, - "Infer function return type": { - "category": "Message", - "code": 95148 - }, - - "Return type must be inferred from a function": { - "category": "Message", - "code": 95149 - }, - "Could not determine function return type": { - "category": "Message", - "code": 95150 - }, - "Could not convert to arrow function": { - "category": "Message", - "code": 95151 - }, - "Could not convert to named function": { - "category": "Message", - "code": 95152 - }, - "Could not convert to anonymous function": { - "category": "Message", - "code": 95153 - }, - "Can only convert string concatenation": { - "category": "Message", - "code": 95154 - }, - "Selection is not a valid statement or statements": { - "category": "Message", - "code": 95155 - }, - "Add 'override' modifier": { - "category": "Message", - "code": 95156 - }, - "Remove 'override' modifier": { - "category": "Message", - "code": 95157 - }, - "Add all 'override' modifier": { - "category": "Message", - "code": 95158 - }, - "Remove all 'override' modifier": { - "category": "Message", - "code": 95159 - }, - "Convert to property declaration and add 'override' modifier": { - "category": "Message", - "code": 95160 - }, - "Convert all to property declaration and add 'override' modifier": { - "category": "Message", - "code": 95161 - }, - - "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { - "category": "Error", - "code": 18004 - }, - "Classes may not have a field named 'constructor'.": { - "category": "Error", - "code": 18006 - }, - "JSX expressions may not use the comma operator. Did you mean to write an array?": { - "category": "Error", - "code": 18007 - }, - "Private identifiers cannot be used as parameters.": { - "category": "Error", - "code": 18009 - }, - "An accessibility modifier cannot be used with a private identifier.": { - "category": "Error", - "code": 18010 - }, - "The operand of a 'delete' operator cannot be a private identifier.": { - "category": "Error", - "code": 18011 - }, - "'#constructor' is a reserved word.": { - "category": "Error", - "code": 18012 - }, - "Property '{0}' is not accessible outside class '{1}' because it has a private identifier.": { - "category": "Error", - "code": 18013 - }, - "The property '{0}' cannot be accessed on type '{1}' within this class because it is shadowed by another private identifier with the same spelling.": { - "category": "Error", - "code": 18014 - }, - "Property '{0}' in type '{1}' refers to a different member that cannot be accessed from within type '{2}'.": { - "category": "Error", - "code": 18015 - }, - "Private identifiers are not allowed outside class bodies.": { - "category": "Error", - "code": 18016 - }, - "The shadowing declaration of '{0}' is defined here": { - "category": "Error", - "code": 18017 - }, - "The declaration of '{0}' that you probably intended to use is defined here": { - "category": "Error", - "code": 18018 - }, - "'{0}' modifier cannot be used with a private identifier.": { - "category": "Error", - "code": 18019 - }, - "A method cannot be named with a private identifier.": { - "category": "Error", - "code": 18022 - }, - "An accessor cannot be named with a private identifier.": { - "category": "Error", - "code": 18023 - }, - "An enum member cannot be named with a private identifier.": { - "category": "Error", - "code": 18024 - }, - "'#!' can only be used at the start of a file.": { - "category": "Error", - "code": 18026 - }, - "Compiler reserves name '{0}' when emitting private identifier downlevel.": { - "category": "Error", - "code": 18027 - }, - "Private identifiers are only available when targeting ECMAScript 2015 and higher.": { - "category": "Error", - "code": 18028 - }, - "Private identifiers are not allowed in variable declarations.": { - "category": "Error", - "code": 18029 - }, - "An optional chain cannot contain private identifiers.": { - "category": "Error", - "code": 18030 - }, - "The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents.": { - "category": "Error", - "code": 18031 - }, - "The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some.": { - "category": "Error", - "code": 18032 - }, - "Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.": { - "category": "Error", - "code": 18033 - }, - "Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'.": { - "category": "Message", - "code": 18034 - }, - "Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name.": { - "category": "Error", - "code": 18035 - } -} +{ + "Unterminated string literal.": { + "category": "Error", + "code": 1002 + }, + "Identifier expected.": { + "category": "Error", + "code": 1003 + }, + "'{0}' expected.": { + "category": "Error", + "code": 1005 + }, + "A file cannot have a reference to itself.": { + "category": "Error", + "code": 1006 + }, + "The parser expected to find a '}' to match the '{' token here.": { + "category": "Error", + "code": 1007 + }, + "Trailing comma not allowed.": { + "category": "Error", + "code": 1009 + }, + "'*/' expected.": { + "category": "Error", + "code": 1010 + }, + "An element access expression should take an argument.": { + "category": "Error", + "code": 1011 + }, + "Unexpected token.": { + "category": "Error", + "code": 1012 + }, + "A rest parameter or binding pattern may not have a trailing comma.": { + "category": "Error", + "code": 1013 + }, + "A rest parameter must be last in a parameter list.": { + "category": "Error", + "code": 1014 + }, + "Parameter cannot have question mark and initializer.": { + "category": "Error", + "code": 1015 + }, + "A required parameter cannot follow an optional parameter.": { + "category": "Error", + "code": 1016 + }, + "An index signature cannot have a rest parameter.": { + "category": "Error", + "code": 1017 + }, + "An index signature parameter cannot have an accessibility modifier.": { + "category": "Error", + "code": 1018 + }, + "An index signature parameter cannot have a question mark.": { + "category": "Error", + "code": 1019 + }, + "An index signature parameter cannot have an initializer.": { + "category": "Error", + "code": 1020 + }, + "An index signature must have a type annotation.": { + "category": "Error", + "code": 1021 + }, + "An index signature parameter must have a type annotation.": { + "category": "Error", + "code": 1022 + }, + "An index signature parameter type must be either 'string' or 'number'.": { + "category": "Error", + "code": 1023 + }, + "'readonly' modifier can only appear on a property declaration or index signature.": { + "category": "Error", + "code": 1024 + }, + "An index signature cannot have a trailing comma.": { + "category": "Error", + "code": 1025 + }, + "Accessibility modifier already seen.": { + "category": "Error", + "code": 1028 + }, + "'{0}' modifier must precede '{1}' modifier.": { + "category": "Error", + "code": 1029 + }, + "'{0}' modifier already seen.": { + "category": "Error", + "code": 1030 + }, + "'{0}' modifier cannot appear on class elements of this kind.": { + "category": "Error", + "code": 1031 + }, + "'super' must be followed by an argument list or member access.": { + "category": "Error", + "code": 1034 + }, + "Only ambient modules can use quoted names.": { + "category": "Error", + "code": 1035 + }, + "Statements are not allowed in ambient contexts.": { + "category": "Error", + "code": 1036 + }, + "A 'declare' modifier cannot be used in an already ambient context.": { + "category": "Error", + "code": 1038 + }, + "Initializers are not allowed in ambient contexts.": { + "category": "Error", + "code": 1039 + }, + "'{0}' modifier cannot be used in an ambient context.": { + "category": "Error", + "code": 1040 + }, + "'{0}' modifier cannot be used with a class declaration.": { + "category": "Error", + "code": 1041 + }, + "'{0}' modifier cannot be used here.": { + "category": "Error", + "code": 1042 + }, + "'{0}' modifier cannot appear on a data property.": { + "category": "Error", + "code": 1043 + }, + "'{0}' modifier cannot appear on a module or namespace element.": { + "category": "Error", + "code": 1044 + }, + "A '{0}' modifier cannot be used with an interface declaration.": { + "category": "Error", + "code": 1045 + }, + "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.": { + "category": "Error", + "code": 1046 + }, + "A rest parameter cannot be optional.": { + "category": "Error", + "code": 1047 + }, + "A rest parameter cannot have an initializer.": { + "category": "Error", + "code": 1048 + }, + "A 'set' accessor must have exactly one parameter.": { + "category": "Error", + "code": 1049 + }, + "A 'set' accessor cannot have an optional parameter.": { + "category": "Error", + "code": 1051 + }, + "A 'set' accessor parameter cannot have an initializer.": { + "category": "Error", + "code": 1052 + }, + "A 'set' accessor cannot have rest parameter.": { + "category": "Error", + "code": 1053 + }, + "A 'get' accessor cannot have parameters.": { + "category": "Error", + "code": 1054 + }, + "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.": { + "category": "Error", + "code": 1055 + }, + "Accessors are only available when targeting ECMAScript 5 and higher.": { + "category": "Error", + "code": 1056 + }, + "An async function or method must have a valid awaitable return type.": { + "category": "Error", + "code": 1057 + }, + "The return type of an async function must either be a valid promise or must not contain a callable 'then' member.": { + "category": "Error", + "code": 1058 + }, + "A promise must have a 'then' method.": { + "category": "Error", + "code": 1059 + }, + "The first parameter of the 'then' method of a promise must be a callback.": { + "category": "Error", + "code": 1060 + }, + "Enum member must have initializer.": { + "category": "Error", + "code": 1061 + }, + "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method.": { + "category": "Error", + "code": 1062 + }, + "An export assignment cannot be used in a namespace.": { + "category": "Error", + "code": 1063 + }, + "The return type of an async function or method must be the global Promise type. Did you mean to write 'Promise<{0}>'?": { + "category": "Error", + "code": 1064 + }, + "In ambient enum declarations member initializer must be constant expression.": { + "category": "Error", + "code": 1066 + }, + "Unexpected token. A constructor, method, accessor, or property was expected.": { + "category": "Error", + "code": 1068 + }, + "Unexpected token. A type parameter name was expected without curly braces.": { + "category": "Error", + "code": 1069 + }, + "'{0}' modifier cannot appear on a type member.": { + "category": "Error", + "code": 1070 + }, + "'{0}' modifier cannot appear on an index signature.": { + "category": "Error", + "code": 1071 + }, + "A '{0}' modifier cannot be used with an import declaration.": { + "category": "Error", + "code": 1079 + }, + "Invalid 'reference' directive syntax.": { + "category": "Error", + "code": 1084 + }, + "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'.": { + "category": "Error", + "code": 1085 + }, + "'{0}' modifier cannot appear on a constructor declaration.": { + "category": "Error", + "code": 1089 + }, + "'{0}' modifier cannot appear on a parameter.": { + "category": "Error", + "code": 1090 + }, + "Only a single variable declaration is allowed in a 'for...in' statement.": { + "category": "Error", + "code": 1091 + }, + "Type parameters cannot appear on a constructor declaration.": { + "category": "Error", + "code": 1092 + }, + "Type annotation cannot appear on a constructor declaration.": { + "category": "Error", + "code": 1093 + }, + "An accessor cannot have type parameters.": { + "category": "Error", + "code": 1094 + }, + "A 'set' accessor cannot have a return type annotation.": { + "category": "Error", + "code": 1095 + }, + "An index signature must have exactly one parameter.": { + "category": "Error", + "code": 1096 + }, + "'{0}' list cannot be empty.": { + "category": "Error", + "code": 1097 + }, + "Type parameter list cannot be empty.": { + "category": "Error", + "code": 1098 + }, + "Type argument list cannot be empty.": { + "category": "Error", + "code": 1099 + }, + "Invalid use of '{0}' in strict mode.": { + "category": "Error", + "code": 1100 + }, + "'with' statements are not allowed in strict mode.": { + "category": "Error", + "code": 1101 + }, + "'delete' cannot be called on an identifier in strict mode.": { + "category": "Error", + "code": 1102 + }, + "A 'for-await-of' statement is only allowed within an async function or async generator.": { + "category": "Error", + "code": 1103 + }, + "A 'continue' statement can only be used within an enclosing iteration statement.": { + "category": "Error", + "code": 1104 + }, + "A 'break' statement can only be used within an enclosing iteration or switch statement.": { + "category": "Error", + "code": 1105 + }, + "Jump target cannot cross function boundary.": { + "category": "Error", + "code": 1107 + }, + "A 'return' statement can only be used within a function body.": { + "category": "Error", + "code": 1108 + }, + "Expression expected.": { + "category": "Error", + "code": 1109 + }, + "Type expected.": { + "category": "Error", + "code": 1110 + }, + "A 'default' clause cannot appear more than once in a 'switch' statement.": { + "category": "Error", + "code": 1113 + }, + "Duplicate label '{0}'.": { + "category": "Error", + "code": 1114 + }, + "A 'continue' statement can only jump to a label of an enclosing iteration statement.": { + "category": "Error", + "code": 1115 + }, + "A 'break' statement can only jump to a label of an enclosing statement.": { + "category": "Error", + "code": 1116 + }, + "An object literal cannot have multiple properties with the same name in strict mode.": { + "category": "Error", + "code": 1117 + }, + "An object literal cannot have multiple get/set accessors with the same name.": { + "category": "Error", + "code": 1118 + }, + "An object literal cannot have property and accessor with the same name.": { + "category": "Error", + "code": 1119 + }, + "An export assignment cannot have modifiers.": { + "category": "Error", + "code": 1120 + }, + "Octal literals are not allowed in strict mode.": { + "category": "Error", + "code": 1121 + }, + "Variable declaration list cannot be empty.": { + "category": "Error", + "code": 1123 + }, + "Digit expected.": { + "category": "Error", + "code": 1124 + }, + "Hexadecimal digit expected.": { + "category": "Error", + "code": 1125 + }, + "Unexpected end of text.": { + "category": "Error", + "code": 1126 + }, + "Invalid character.": { + "category": "Error", + "code": 1127 + }, + "Declaration or statement expected.": { + "category": "Error", + "code": 1128 + }, + "Statement expected.": { + "category": "Error", + "code": 1129 + }, + "'case' or 'default' expected.": { + "category": "Error", + "code": 1130 + }, + "Property or signature expected.": { + "category": "Error", + "code": 1131 + }, + "Enum member expected.": { + "category": "Error", + "code": 1132 + }, + "Variable declaration expected.": { + "category": "Error", + "code": 1134 + }, + "Argument expression expected.": { + "category": "Error", + "code": 1135 + }, + "Property assignment expected.": { + "category": "Error", + "code": 1136 + }, + "Expression or comma expected.": { + "category": "Error", + "code": 1137 + }, + "Parameter declaration expected.": { + "category": "Error", + "code": 1138 + }, + "Type parameter declaration expected.": { + "category": "Error", + "code": 1139 + }, + "Type argument expected.": { + "category": "Error", + "code": 1140 + }, + "String literal expected.": { + "category": "Error", + "code": 1141 + }, + "Line break not permitted here.": { + "category": "Error", + "code": 1142 + }, + "'{' or ';' expected.": { + "category": "Error", + "code": 1144 + }, + "Declaration expected.": { + "category": "Error", + "code": 1146 + }, + "Import declarations in a namespace cannot reference a module.": { + "category": "Error", + "code": 1147 + }, + "Cannot use imports, exports, or module augmentations when '--module' is 'none'.": { + "category": "Error", + "code": 1148 + }, + "File name '{0}' differs from already included file name '{1}' only in casing.": { + "category": "Error", + "code": 1149 + }, + "'const' declarations must be initialized.": { + "category": "Error", + "code": 1155 + }, + "'const' declarations can only be declared inside a block.": { + "category": "Error", + "code": 1156 + }, + "'let' declarations can only be declared inside a block.": { + "category": "Error", + "code": 1157 + }, + "Unterminated template literal.": { + "category": "Error", + "code": 1160 + }, + "Unterminated regular expression literal.": { + "category": "Error", + "code": 1161 + }, + "An object member cannot be declared optional.": { + "category": "Error", + "code": 1162 + }, + "A 'yield' expression is only allowed in a generator body.": { + "category": "Error", + "code": 1163 + }, + "Computed property names are not allowed in enums.": { + "category": "Error", + "code": 1164 + }, + "A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.": { + "category": "Error", + "code": 1165 + }, + "A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.": { + "category": "Error", + "code": 1166 + }, + "A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.": { + "category": "Error", + "code": 1168 + }, + "A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.": { + "category": "Error", + "code": 1169 + }, + "A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.": { + "category": "Error", + "code": 1170 + }, + "A comma expression is not allowed in a computed property name.": { + "category": "Error", + "code": 1171 + }, + "'extends' clause already seen.": { + "category": "Error", + "code": 1172 + }, + "'extends' clause must precede 'implements' clause.": { + "category": "Error", + "code": 1173 + }, + "Classes can only extend a single class.": { + "category": "Error", + "code": 1174 + }, + "'implements' clause already seen.": { + "category": "Error", + "code": 1175 + }, + "Interface declaration cannot have 'implements' clause.": { + "category": "Error", + "code": 1176 + }, + "Binary digit expected.": { + "category": "Error", + "code": 1177 + }, + "Octal digit expected.": { + "category": "Error", + "code": 1178 + }, + "Unexpected token. '{' expected.": { + "category": "Error", + "code": 1179 + }, + "Property destructuring pattern expected.": { + "category": "Error", + "code": 1180 + }, + "Array element destructuring pattern expected.": { + "category": "Error", + "code": 1181 + }, + "A destructuring declaration must have an initializer.": { + "category": "Error", + "code": 1182 + }, + "An implementation cannot be declared in ambient contexts.": { + "category": "Error", + "code": 1183 + }, + "Modifiers cannot appear here.": { + "category": "Error", + "code": 1184 + }, + "Merge conflict marker encountered.": { + "category": "Error", + "code": 1185 + }, + "A rest element cannot have an initializer.": { + "category": "Error", + "code": 1186 + }, + "A parameter property may not be declared using a binding pattern.": { + "category": "Error", + "code": 1187 + }, + "Only a single variable declaration is allowed in a 'for...of' statement.": { + "category": "Error", + "code": 1188 + }, + "The variable declaration of a 'for...in' statement cannot have an initializer.": { + "category": "Error", + "code": 1189 + }, + "The variable declaration of a 'for...of' statement cannot have an initializer.": { + "category": "Error", + "code": 1190 + }, + "An import declaration cannot have modifiers.": { + "category": "Error", + "code": 1191 + }, + "Module '{0}' has no default export.": { + "category": "Error", + "code": 1192 + }, + "An export declaration cannot have modifiers.": { + "category": "Error", + "code": 1193 + }, + "Export declarations are not permitted in a namespace.": { + "category": "Error", + "code": 1194 + }, + "'export *' does not re-export a default.": { + "category": "Error", + "code": 1195 + }, + "Catch clause variable type annotation must be 'any' or 'unknown' if specified.": { + "category": "Error", + "code": 1196 + }, + "Catch clause variable cannot have an initializer.": { + "category": "Error", + "code": 1197 + }, + "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.": { + "category": "Error", + "code": 1198 + }, + "Unterminated Unicode escape sequence.": { + "category": "Error", + "code": 1199 + }, + "Line terminator not permitted before arrow.": { + "category": "Error", + "code": 1200 + }, + "Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.": { + "category": "Error", + "code": 1202 + }, + "Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.": { + "category": "Error", + "code": 1203 + }, + "Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.": { + "category": "Error", + "code": 1205 + }, + "Decorators are not valid here.": { + "category": "Error", + "code": 1206 + }, + "Decorators cannot be applied to multiple get/set accessors of the same name.": { + "category": "Error", + "code": 1207 + }, + "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module.": { + "category": "Error", + "code": 1208 + }, + "Invalid use of '{0}'. Class definitions are automatically in strict mode.": { + "category": "Error", + "code": 1210 + }, + "A class declaration without the 'default' modifier must have a name.": { + "category": "Error", + "code": 1211 + }, + "Identifier expected. '{0}' is a reserved word in strict mode.": { + "category": "Error", + "code": 1212 + }, + "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.": { + "category": "Error", + "code": 1213 + }, + "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode.": { + "category": "Error", + "code": 1214 + }, + "Invalid use of '{0}'. Modules are automatically in strict mode.": { + "category": "Error", + "code": 1215 + }, + "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules.": { + "category": "Error", + "code": 1216 + }, + "Export assignment is not supported when '--module' flag is 'system'.": { + "category": "Error", + "code": 1218 + }, + "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.": { + "category": "Error", + "code": 1219 + }, + "Generators are only available when targeting ECMAScript 2015 or higher.": { + "category": "Error", + "code": 1220 + }, + "Generators are not allowed in an ambient context.": { + "category": "Error", + "code": 1221 + }, + "An overload signature cannot be declared as a generator.": { + "category": "Error", + "code": 1222 + }, + "'{0}' tag already specified.": { + "category": "Error", + "code": 1223 + }, + "Signature '{0}' must be a type predicate.": { + "category": "Error", + "code": 1224 + }, + "Cannot find parameter '{0}'.": { + "category": "Error", + "code": 1225 + }, + "Type predicate '{0}' is not assignable to '{1}'.": { + "category": "Error", + "code": 1226 + }, + "Parameter '{0}' is not in the same position as parameter '{1}'.": { + "category": "Error", + "code": 1227 + }, + "A type predicate is only allowed in return type position for functions and methods.": { + "category": "Error", + "code": 1228 + }, + "A type predicate cannot reference a rest parameter.": { + "category": "Error", + "code": 1229 + }, + "A type predicate cannot reference element '{0}' in a binding pattern.": { + "category": "Error", + "code": 1230 + }, + "An export assignment can only be used in a module.": { + "category": "Error", + "code": 1231 + }, + "An import declaration can only be used in a namespace or module.": { + "category": "Error", + "code": 1232 + }, + "An export declaration can only be used in a module.": { + "category": "Error", + "code": 1233 + }, + "An ambient module declaration is only allowed at the top level in a file.": { + "category": "Error", + "code": 1234 + }, + "A namespace declaration is only allowed in a namespace or module.": { + "category": "Error", + "code": 1235 + }, + "The return type of a property decorator function must be either 'void' or 'any'.": { + "category": "Error", + "code": 1236 + }, + "The return type of a parameter decorator function must be either 'void' or 'any'.": { + "category": "Error", + "code": 1237 + }, + "Unable to resolve signature of class decorator when called as an expression.": { + "category": "Error", + "code": 1238 + }, + "Unable to resolve signature of parameter decorator when called as an expression.": { + "category": "Error", + "code": 1239 + }, + "Unable to resolve signature of property decorator when called as an expression.": { + "category": "Error", + "code": 1240 + }, + "Unable to resolve signature of method decorator when called as an expression.": { + "category": "Error", + "code": 1241 + }, + "'abstract' modifier can only appear on a class, method, or property declaration.": { + "category": "Error", + "code": 1242 + }, + "'{0}' modifier cannot be used with '{1}' modifier.": { + "category": "Error", + "code": 1243 + }, + "Abstract methods can only appear within an abstract class.": { + "category": "Error", + "code": 1244 + }, + "Method '{0}' cannot have an implementation because it is marked abstract.": { + "category": "Error", + "code": 1245 + }, + "An interface property cannot have an initializer.": { + "category": "Error", + "code": 1246 + }, + "A type literal property cannot have an initializer.": { + "category": "Error", + "code": 1247 + }, + "A class member cannot have the '{0}' keyword.": { + "category": "Error", + "code": 1248 + }, + "A decorator can only decorate a method implementation, not an overload.": { + "category": "Error", + "code": 1249 + }, + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.": { + "category": "Error", + "code": 1250 + }, + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.": { + "category": "Error", + "code": 1251 + }, + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.": { + "category": "Error", + "code": 1252 + }, + "'{0}' tag cannot be used independently as a top level JSDoc tag.": { + "category": "Error", + "code": 1253 + }, + "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.": { + "category": "Error", + "code": 1254 + }, + "A definite assignment assertion '!' is not permitted in this context.": { + "category": "Error", + "code": 1255 + }, + "A rest element must be last in a tuple type.": { + "category": "Error", + "code": 1256 + }, + "A required element cannot follow an optional element.": { + "category": "Error", + "code": 1257 + }, + "Module '{0}' can only be default-imported using the '{1}' flag": { + "category": "Error", + "code": 1259 + }, + "Keywords cannot contain escape characters.": { + "category": "Error", + "code": 1260 + }, + "Already included file name '{0}' differs from file name '{1}' only in casing.": { + "category": "Error", + "code": 1261 + }, + "Identifier expected. '{0}' is a reserved word at the top-level of a module.": { + "category": "Error", + "code": 1262 + }, + "Declarations with initializers cannot also have definite assignment assertions.": { + "category": "Error", + "code": 1263 + }, + "Declarations with definite assignment assertions must also have type annotations.": { + "category": "Error", + "code": 1264 + }, + + "'with' statements are not allowed in an async function block.": { + "category": "Error", + "code": 1300 + }, + "'await' expressions are only allowed within async functions and at the top levels of modules.": { + "category": "Error", + "code": 1308 + }, + "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern.": { + "category": "Error", + "code": 1312 + }, + "The body of an 'if' statement cannot be the empty statement.": { + "category": "Error", + "code": 1313 + }, + "Global module exports may only appear in module files.": { + "category": "Error", + "code": 1314 + }, + "Global module exports may only appear in declaration files.": { + "category": "Error", + "code": 1315 + }, + "Global module exports may only appear at top level.": { + "category": "Error", + "code": 1316 + }, + "A parameter property cannot be declared using a rest parameter.": { + "category": "Error", + "code": 1317 + }, + "An abstract accessor cannot have an implementation.": { + "category": "Error", + "code": 1318 + }, + "A default export can only be used in an ECMAScript-style module.": { + "category": "Error", + "code": 1319 + }, + "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member.": { + "category": "Error", + "code": 1320 + }, + "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member.": { + "category": "Error", + "code": 1321 + }, + "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member.": { + "category": "Error", + "code": 1322 + }, + "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": { + "category": "Error", + "code": 1323 + }, + "Dynamic import must have one specifier as an argument.": { + "category": "Error", + "code": 1324 + }, + "Specifier of dynamic import cannot be spread element.": { + "category": "Error", + "code": 1325 + }, + "Dynamic import cannot have type arguments.": { + "category": "Error", + "code": 1326 + }, + "String literal with double quotes expected.": { + "category": "Error", + "code": 1327 + }, + "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.": { + "category": "Error", + "code": 1328 + }, + "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?": { + "category": "Error", + "code": 1329 + }, + "A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.": { + "category": "Error", + "code": 1330 + }, + "A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.": { + "category": "Error", + "code": 1331 + }, + "A variable whose type is a 'unique symbol' type must be 'const'.": { + "category": "Error", + "code": 1332 + }, + "'unique symbol' types may not be used on a variable declaration with a binding name.": { + "category": "Error", + "code": 1333 + }, + "'unique symbol' types are only allowed on variables in a variable statement.": { + "category": "Error", + "code": 1334 + }, + "'unique symbol' types are not allowed here.": { + "category": "Error", + "code": 1335 + }, + "An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead.": { + "category": "Error", + "code": 1336 + }, + "An index signature parameter type cannot be a union type. Consider using a mapped object type instead.": { + "category": "Error", + "code": 1337 + }, + "'infer' declarations are only permitted in the 'extends' clause of a conditional type.": { + "category": "Error", + "code": 1338 + }, + "Module '{0}' does not refer to a value, but is used as a value here.": { + "category": "Error", + "code": 1339 + }, + "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?": { + "category": "Error", + "code": 1340 + }, + "Type arguments cannot be used here.": { + "category": "Error", + "code": 1342 + }, + "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.": { + "category": "Error", + "code": 1343 + }, + "'A label is not allowed here.": { + "category": "Error", + "code": 1344 + }, + "An expression of type 'void' cannot be tested for truthiness.": { + "category": "Error", + "code": 1345 + }, + "This parameter is not allowed with 'use strict' directive.": { + "category": "Error", + "code": 1346 + }, + "'use strict' directive cannot be used with non-simple parameter list.": { + "category": "Error", + "code": 1347 + }, + "Non-simple parameter declared here.": { + "category": "Error", + "code": 1348 + }, + "'use strict' directive used here.": { + "category": "Error", + "code": 1349 + }, + "Print the final configuration instead of building.": { + "category": "Message", + "code": 1350 + }, + "An identifier or keyword cannot immediately follow a numeric literal.": { + "category": "Error", + "code": 1351 + }, + "A bigint literal cannot use exponential notation.": { + "category": "Error", + "code": 1352 + }, + "A bigint literal must be an integer.": { + "category": "Error", + "code": 1353 + }, + "'readonly' type modifier is only permitted on array and tuple literal types.": { + "category": "Error", + "code": 1354 + }, + "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.": { + "category": "Error", + "code": 1355 + }, + "Did you mean to mark this function as 'async'?": { + "category": "Error", + "code": 1356 + }, + "An enum member name must be followed by a ',', '=', or '}'.": { + "category": "Error", + "code": 1357 + }, + "Tagged template expressions are not permitted in an optional chain.": { + "category": "Error", + "code": 1358 + }, + "Identifier expected. '{0}' is a reserved word that cannot be used here.": { + "category": "Error", + "code": 1359 + }, + "Did you mean to parenthesize this function type?": { + "category": "Error", + "code": 1360 + }, + "'{0}' cannot be used as a value because it was imported using 'import type'.": { + "category": "Error", + "code": 1361 + }, + "'{0}' cannot be used as a value because it was exported using 'export type'.": { + "category": "Error", + "code": 1362 + }, + "A type-only import can specify a default import or named bindings, but not both.": { + "category": "Error", + "code": 1363 + }, + "Convert to type-only export": { + "category": "Message", + "code": 1364 + }, + "Convert all re-exported types to type-only exports": { + "category": "Message", + "code": 1365 + }, + "Split into two separate import declarations": { + "category": "Message", + "code": 1366 + }, + "Split all invalid type-only imports": { + "category": "Message", + "code": 1367 + }, + "Specify emit/checking behavior for imports that are only used for types": { + "category": "Message", + "code": 1368 + }, + "Did you mean '{0}'?": { + "category": "Message", + "code": 1369 + }, + "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.": { + "category": "Error", + "code": 1371 + }, + "Convert to type-only import": { + "category": "Message", + "code": 1373 + }, + "Convert all imports not used as a value to type-only imports": { + "category": "Message", + "code": 1374 + }, + "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.": { + "category": "Error", + "code": 1375 + }, + "'{0}' was imported here.": { + "category": "Message", + "code": 1376 + }, + "'{0}' was exported here.": { + "category": "Message", + "code": 1377 + }, + "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.": { + "category": "Error", + "code": 1378 + }, + "An import alias cannot reference a declaration that was exported using 'export type'.": { + "category": "Error", + "code": 1379 + }, + "An import alias cannot reference a declaration that was imported using 'import type'.": { + "category": "Error", + "code": 1380 + }, + "Unexpected token. Did you mean `{'}'}` or `}`?": { + "category": "Error", + "code": 1381 + }, + "Unexpected token. Did you mean `{'>'}` or `>`?": { + "category": "Error", + "code": 1382 + }, + "Only named exports may use 'export type'.": { + "category": "Error", + "code": 1383 + }, + "A 'new' expression with type arguments must always be followed by a parenthesized argument list.": { + "category": "Error", + "code": 1384 + }, + "Function type notation must be parenthesized when used in a union type.": { + "category": "Error", + "code": 1385 + }, + "Constructor type notation must be parenthesized when used in a union type.": { + "category": "Error", + "code": 1386 + }, + "Function type notation must be parenthesized when used in an intersection type.": { + "category": "Error", + "code": 1387 + }, + "Constructor type notation must be parenthesized when used in an intersection type.": { + "category": "Error", + "code": 1388 + }, + "'{0}' is not allowed as a variable declaration name.": { + "category": "Error", + "code": 1389 + }, + "Provides a root package name when using outFile with declarations.": { + "category": "Message", + "code": 1390 + }, + "The `bundledPackageName` option must be provided when using outFile and node module resolution with declaration emit.": { + "category": "Error", + "code": 1391 + }, + "An import alias cannot use 'import type'": { + "category": "Error", + "code": 1392 + }, + "Imported via {0} from file '{1}'": { + "category": "Message", + "code": 1393 + }, + "Imported via {0} from file '{1}' with packageId '{2}'": { + "category": "Message", + "code": 1394 + }, + "Imported via {0} from file '{1}' to import 'importHelpers' as specified in compilerOptions": { + "category": "Message", + "code": 1395 + }, + "Imported via {0} from file '{1}' with packageId '{2}' to import 'importHelpers' as specified in compilerOptions": { + "category": "Message", + "code": 1396 + }, + "Imported via {0} from file '{1}' to import 'jsx' and 'jsxs' factory functions": { + "category": "Message", + "code": 1397 + }, + "Imported via {0} from file '{1}' with packageId '{2}' to import 'jsx' and 'jsxs' factory functions": { + "category": "Message", + "code": 1398 + }, + "File is included via import here.": { + "category": "Message", + "code": 1399 + }, + "Referenced via '{0}' from file '{1}'": { + "category": "Message", + "code": 1400 + }, + "File is included via reference here.": { + "category": "Message", + "code": 1401 + }, + "Type library referenced via '{0}' from file '{1}'": { + "category": "Message", + "code": 1402 + }, + "Type library referenced via '{0}' from file '{1}' with packageId '{2}'": { + "category": "Message", + "code": 1403 + }, + "File is included via type library reference here.": { + "category": "Message", + "code": 1404 + }, + "Library referenced via '{0}' from file '{1}'": { + "category": "Message", + "code": 1405 + }, + "File is included via library reference here.": { + "category": "Message", + "code": 1406 + }, + "Matched by include pattern '{0}' in '{1}'": { + "category": "Message", + "code": 1407 + }, + "File is matched by include pattern specified here.": { + "category": "Message", + "code": 1408 + }, + "Part of 'files' list in tsconfig.json": { + "category": "Message", + "code": 1409 + }, + "File is matched by 'files' list specified here.": { + "category": "Message", + "code": 1410 + }, + "Output from referenced project '{0}' included because '{1}' specified": { + "category": "Message", + "code": 1411 + }, + "Output from referenced project '{0}' included because '--module' is specified as 'none'": { + "category": "Message", + "code": 1412 + }, + "File is output from referenced project specified here.": { + "category": "Message", + "code": 1413 + }, + "Source from referenced project '{0}' included because '{1}' specified": { + "category": "Message", + "code": 1414 + }, + "Source from referenced project '{0}' included because '--module' is specified as 'none'": { + "category": "Message", + "code": 1415 + }, + "File is source from referenced project specified here.": { + "category": "Message", + "code": 1416 + }, + "Entry point of type library '{0}' specified in compilerOptions": { + "category": "Message", + "code": 1417 + }, + "Entry point of type library '{0}' specified in compilerOptions with packageId '{1}'": { + "category": "Message", + "code": 1418 + }, + "File is entry point of type library specified here.": { + "category": "Message", + "code": 1419 + }, + "Entry point for implicit type library '{0}'": { + "category": "Message", + "code": 1420 + }, + "Entry point for implicit type library '{0}' with packageId '{1}'": { + "category": "Message", + "code": 1421 + }, + "Library '{0}' specified in compilerOptions": { + "category": "Message", + "code": 1422 + }, + "File is library specified here.": { + "category": "Message", + "code": 1423 + }, + "Default library": { + "category": "Message", + "code": 1424 + }, + "Default library for target '{0}'": { + "category": "Message", + "code": 1425 + }, + "File is default library for target specified here.": { + "category": "Message", + "code": 1426 + }, + "Root file specified for compilation": { + "category": "Message", + "code": 1427 + }, + "File is output of project reference source '{0}'": { + "category": "Message", + "code": 1428 + }, + "File redirects to file '{0}'": { + "category": "Message", + "code": 1429 + }, + "The file is in the program because:": { + "category": "Message", + "code": 1430 + }, + "The types of '{0}' are incompatible between these types.": { + "category": "Error", + "code": 2200 + }, + "The types returned by '{0}' are incompatible between these types.": { + "category": "Error", + "code": 2201 + }, + "Call signature return types '{0}' and '{1}' are incompatible.": { + "category": "Error", + "code": 2202, + "elidedInCompatabilityPyramid": true + }, + "Construct signature return types '{0}' and '{1}' are incompatible.": { + "category": "Error", + "code": 2203, + "elidedInCompatabilityPyramid": true + }, + "Call signatures with no arguments have incompatible return types '{0}' and '{1}'.": { + "category": "Error", + "code": 2204, + "elidedInCompatabilityPyramid": true + }, + "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.": { + "category": "Error", + "code": 2205, + "elidedInCompatabilityPyramid": true + }, + + "Duplicate identifier '{0}'.": { + "category": "Error", + "code": 2300 + }, + "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor.": { + "category": "Error", + "code": 2301 + }, + "Static members cannot reference class type parameters.": { + "category": "Error", + "code": 2302 + }, + "Circular definition of import alias '{0}'.": { + "category": "Error", + "code": 2303 + }, + "Cannot find name '{0}'.": { + "category": "Error", + "code": 2304 + }, + "Module '{0}' has no exported member '{1}'.": { + "category": "Error", + "code": 2305 + }, + "File '{0}' is not a module.": { + "category": "Error", + "code": 2306 + }, + "Cannot find module '{0}' or its corresponding type declarations.": { + "category": "Error", + "code": 2307 + }, + "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity.": { + "category": "Error", + "code": 2308 + }, + "An export assignment cannot be used in a module with other exported elements.": { + "category": "Error", + "code": 2309 + }, + "Type '{0}' recursively references itself as a base type.": { + "category": "Error", + "code": 2310 + }, + "A class may only extend another class.": { + "category": "Error", + "code": 2311 + }, + "An interface can only extend an object type or intersection of object types with statically known members.": { + "category": "Error", + "code": 2312 + }, + "Type parameter '{0}' has a circular constraint.": { + "category": "Error", + "code": 2313 + }, + "Generic type '{0}' requires {1} type argument(s).": { + "category": "Error", + "code": 2314 + }, + "Type '{0}' is not generic.": { + "category": "Error", + "code": 2315 + }, + "Global type '{0}' must be a class or interface type.": { + "category": "Error", + "code": 2316 + }, + "Global type '{0}' must have {1} type parameter(s).": { + "category": "Error", + "code": 2317 + }, + "Cannot find global type '{0}'.": { + "category": "Error", + "code": 2318 + }, + "Named property '{0}' of types '{1}' and '{2}' are not identical.": { + "category": "Error", + "code": 2319 + }, + "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'.": { + "category": "Error", + "code": 2320 + }, + "Excessive stack depth comparing types '{0}' and '{1}'.": { + "category": "Error", + "code": 2321 + }, + "Type '{0}' is not assignable to type '{1}'.": { + "category": "Error", + "code": 2322 + }, + "Cannot redeclare exported variable '{0}'.": { + "category": "Error", + "code": 2323 + }, + "Property '{0}' is missing in type '{1}'.": { + "category": "Error", + "code": 2324 + }, + "Property '{0}' is private in type '{1}' but not in type '{2}'.": { + "category": "Error", + "code": 2325 + }, + "Types of property '{0}' are incompatible.": { + "category": "Error", + "code": 2326 + }, + "Property '{0}' is optional in type '{1}' but required in type '{2}'.": { + "category": "Error", + "code": 2327 + }, + "Types of parameters '{0}' and '{1}' are incompatible.": { + "category": "Error", + "code": 2328 + }, + "Index signature is missing in type '{0}'.": { + "category": "Error", + "code": 2329 + }, + "Index signatures are incompatible.": { + "category": "Error", + "code": 2330 + }, + "'this' cannot be referenced in a module or namespace body.": { + "category": "Error", + "code": 2331 + }, + "'this' cannot be referenced in current location.": { + "category": "Error", + "code": 2332 + }, + "'this' cannot be referenced in constructor arguments.": { + "category": "Error", + "code": 2333 + }, + "'this' cannot be referenced in a static property initializer.": { + "category": "Error", + "code": 2334 + }, + "'super' can only be referenced in a derived class.": { + "category": "Error", + "code": 2335 + }, + "'super' cannot be referenced in constructor arguments.": { + "category": "Error", + "code": 2336 + }, + "Super calls are not permitted outside constructors or in nested functions inside constructors.": { + "category": "Error", + "code": 2337 + }, + "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class.": { + "category": "Error", + "code": 2338 + }, + "Property '{0}' does not exist on type '{1}'.": { + "category": "Error", + "code": 2339 + }, + "Only public and protected methods of the base class are accessible via the 'super' keyword.": { + "category": "Error", + "code": 2340 + }, + "Property '{0}' is private and only accessible within class '{1}'.": { + "category": "Error", + "code": 2341 + }, + "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.": { + "category": "Error", + "code": 2342 + }, + "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'.": { + "category": "Error", + "code": 2343 + }, + "Type '{0}' does not satisfy the constraint '{1}'.": { + "category": "Error", + "code": 2344 + }, + "Argument of type '{0}' is not assignable to parameter of type '{1}'.": { + "category": "Error", + "code": 2345 + }, + "Call target does not contain any signatures.": { + "category": "Error", + "code": 2346 + }, + "Untyped function calls may not accept type arguments.": { + "category": "Error", + "code": 2347 + }, + "Value of type '{0}' is not callable. Did you mean to include 'new'?": { + "category": "Error", + "code": 2348 + }, + "This expression is not callable.": { + "category": "Error", + "code": 2349 + }, + "Only a void function can be called with the 'new' keyword.": { + "category": "Error", + "code": 2350 + }, + "This expression is not constructable.": { + "category": "Error", + "code": 2351 + }, + "Conversion of type '{0}' to type '{1}' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": { + "category": "Error", + "code": 2352 + }, + "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'.": { + "category": "Error", + "code": 2353 + }, + "This syntax requires an imported helper but module '{0}' cannot be found.": { + "category": "Error", + "code": 2354 + }, + "A function whose declared type is neither 'void' nor 'any' must return a value.": { + "category": "Error", + "code": 2355 + }, + "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.": { + "category": "Error", + "code": 2356 + }, + "The operand of an increment or decrement operator must be a variable or a property access.": { + "category": "Error", + "code": 2357 + }, + "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.": { + "category": "Error", + "code": 2358 + }, + "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.": { + "category": "Error", + "code": 2359 + }, + "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.": { + "category": "Error", + "code": 2360 + }, + "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter.": { + "category": "Error", + "code": 2361 + }, + "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.": { + "category": "Error", + "code": 2362 + }, + "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.": { + "category": "Error", + "code": 2363 + }, + "The left-hand side of an assignment expression must be a variable or a property access.": { + "category": "Error", + "code": 2364 + }, + "Operator '{0}' cannot be applied to types '{1}' and '{2}'.": { + "category": "Error", + "code": 2365 + }, + "Function lacks ending return statement and return type does not include 'undefined'.": { + "category": "Error", + "code": 2366 + }, + "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap.": { + "category": "Error", + "code": 2367 + }, + "Type parameter name cannot be '{0}'.": { + "category": "Error", + "code": 2368 + }, + "A parameter property is only allowed in a constructor implementation.": { + "category": "Error", + "code": 2369 + }, + "A rest parameter must be of an array type.": { + "category": "Error", + "code": 2370 + }, + "A parameter initializer is only allowed in a function or constructor implementation.": { + "category": "Error", + "code": 2371 + }, + "Parameter '{0}' cannot reference itself.": { + "category": "Error", + "code": 2372 + }, + "Parameter '{0}' cannot reference identifier '{1}' declared after it.": { + "category": "Error", + "code": 2373 + }, + "Duplicate string index signature.": { + "category": "Error", + "code": 2374 + }, + "Duplicate number index signature.": { + "category": "Error", + "code": 2375 + }, + "A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.": { + "category": "Error", + "code": 2376 + }, + "Constructors for derived classes must contain a 'super' call.": { + "category": "Error", + "code": 2377 + }, + "A 'get' accessor must return a value.": { + "category": "Error", + "code": 2378 + }, + "Getter and setter accessors do not agree in visibility.": { + "category": "Error", + "code": 2379 + }, + "'get' and 'set' accessor must have the same type.": { + "category": "Error", + "code": 2380 + }, + "A signature with an implementation cannot use a string literal type.": { + "category": "Error", + "code": 2381 + }, + "Specialized overload signature is not assignable to any non-specialized signature.": { + "category": "Error", + "code": 2382 + }, + "Overload signatures must all be exported or non-exported.": { + "category": "Error", + "code": 2383 + }, + "Overload signatures must all be ambient or non-ambient.": { + "category": "Error", + "code": 2384 + }, + "Overload signatures must all be public, private or protected.": { + "category": "Error", + "code": 2385 + }, + "Overload signatures must all be optional or required.": { + "category": "Error", + "code": 2386 + }, + "Function overload must be static.": { + "category": "Error", + "code": 2387 + }, + "Function overload must not be static.": { + "category": "Error", + "code": 2388 + }, + "Function implementation name must be '{0}'.": { + "category": "Error", + "code": 2389 + }, + "Constructor implementation is missing.": { + "category": "Error", + "code": 2390 + }, + "Function implementation is missing or not immediately following the declaration.": { + "category": "Error", + "code": 2391 + }, + "Multiple constructor implementations are not allowed.": { + "category": "Error", + "code": 2392 + }, + "Duplicate function implementation.": { + "category": "Error", + "code": 2393 + }, + "This overload signature is not compatible with its implementation signature.": { + "category": "Error", + "code": 2394 + }, + "Individual declarations in merged declaration '{0}' must be all exported or all local.": { + "category": "Error", + "code": 2395 + }, + "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.": { + "category": "Error", + "code": 2396 + }, + "Declaration name conflicts with built-in global identifier '{0}'.": { + "category": "Error", + "code": 2397 + }, + "'constructor' cannot be used as a parameter property name.": { + "category": "Error", + "code": 2398 + }, + "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.": { + "category": "Error", + "code": 2399 + }, + "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.": { + "category": "Error", + "code": 2400 + }, + "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference.": { + "category": "Error", + "code": 2401 + }, + "Expression resolves to '_super' that compiler uses to capture base class reference.": { + "category": "Error", + "code": 2402 + }, + "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": { + "category": "Error", + "code": 2403 + }, + "The left-hand side of a 'for...in' statement cannot use a type annotation.": { + "category": "Error", + "code": 2404 + }, + "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'.": { + "category": "Error", + "code": 2405 + }, + "The left-hand side of a 'for...in' statement must be a variable or a property access.": { + "category": "Error", + "code": 2406 + }, + "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter, but here has type '{0}'.": { + "category": "Error", + "code": 2407 + }, + "Setters cannot return a value.": { + "category": "Error", + "code": 2408 + }, + "Return type of constructor signature must be assignable to the instance type of the class.": { + "category": "Error", + "code": 2409 + }, + "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'.": { + "category": "Error", + "code": 2410 + }, + "Property '{0}' of type '{1}' is not assignable to string index type '{2}'.": { + "category": "Error", + "code": 2411 + }, + "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'.": { + "category": "Error", + "code": 2412 + }, + "Numeric index type '{0}' is not assignable to string index type '{1}'.": { + "category": "Error", + "code": 2413 + }, + "Class name cannot be '{0}'.": { + "category": "Error", + "code": 2414 + }, + "Class '{0}' incorrectly extends base class '{1}'.": { + "category": "Error", + "code": 2415 + }, + "Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'.": { + "category": "Error", + "code": 2416 + }, + "Class static side '{0}' incorrectly extends base class static side '{1}'.": { + "category": "Error", + "code": 2417 + }, + "Type of computed property's value is '{0}', which is not assignable to type '{1}'.": { + "category": "Error", + "code": 2418 + }, + "Types of construct signatures are incompatible.": { + "category": "Error", + "code": 2419 + }, + "Class '{0}' incorrectly implements interface '{1}'.": { + "category": "Error", + "code": 2420 + }, + "A class can only implement an object type or intersection of object types with statically known members.": { + "category": "Error", + "code": 2422 + }, + "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.": { + "category": "Error", + "code": 2423 + }, + "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.": { + "category": "Error", + "code": 2425 + }, + "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.": { + "category": "Error", + "code": 2426 + }, + "Interface name cannot be '{0}'.": { + "category": "Error", + "code": 2427 + }, + "All declarations of '{0}' must have identical type parameters.": { + "category": "Error", + "code": 2428 + }, + "Interface '{0}' incorrectly extends interface '{1}'.": { + "category": "Error", + "code": 2430 + }, + "Enum name cannot be '{0}'.": { + "category": "Error", + "code": 2431 + }, + "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element.": { + "category": "Error", + "code": 2432 + }, + "A namespace declaration cannot be in a different file from a class or function with which it is merged.": { + "category": "Error", + "code": 2433 + }, + "A namespace declaration cannot be located prior to a class or function with which it is merged.": { + "category": "Error", + "code": 2434 + }, + "Ambient modules cannot be nested in other modules or namespaces.": { + "category": "Error", + "code": 2435 + }, + "Ambient module declaration cannot specify relative module name.": { + "category": "Error", + "code": 2436 + }, + "Module '{0}' is hidden by a local declaration with the same name.": { + "category": "Error", + "code": 2437 + }, + "Import name cannot be '{0}'.": { + "category": "Error", + "code": 2438 + }, + "Import or export declaration in an ambient module declaration cannot reference module through relative module name.": { + "category": "Error", + "code": 2439 + }, + "Import declaration conflicts with local declaration of '{0}'.": { + "category": "Error", + "code": 2440 + }, + "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module.": { + "category": "Error", + "code": 2441 + }, + "Types have separate declarations of a private property '{0}'.": { + "category": "Error", + "code": 2442 + }, + "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'.": { + "category": "Error", + "code": 2443 + }, + "Property '{0}' is protected in type '{1}' but public in type '{2}'.": { + "category": "Error", + "code": 2444 + }, + "Property '{0}' is protected and only accessible within class '{1}' and its subclasses.": { + "category": "Error", + "code": 2445 + }, + "Property '{0}' is protected and only accessible through an instance of class '{1}'.": { + "category": "Error", + "code": 2446 + }, + "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead.": { + "category": "Error", + "code": 2447 + }, + "Block-scoped variable '{0}' used before its declaration.": { + "category": "Error", + "code": 2448 + }, + "Class '{0}' used before its declaration.": { + "category": "Error", + "code": 2449 + }, + "Enum '{0}' used before its declaration.": { + "category": "Error", + "code": 2450 + }, + "Cannot redeclare block-scoped variable '{0}'.": { + "category": "Error", + "code": 2451 + }, + "An enum member cannot have a numeric name.": { + "category": "Error", + "code": 2452 + }, + "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly.": { + "category": "Error", + "code": 2453 + }, + "Variable '{0}' is used before being assigned.": { + "category": "Error", + "code": 2454 + }, + "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'.": { + "category": "Error", + "code": 2455 + }, + "Type alias '{0}' circularly references itself.": { + "category": "Error", + "code": 2456 + }, + "Type alias name cannot be '{0}'.": { + "category": "Error", + "code": 2457 + }, + "An AMD module cannot have multiple name assignments.": { + "category": "Error", + "code": 2458 + }, + "Module '{0}' declares '{1}' locally, but it is not exported.": { + "category": "Error", + "code": 2459 + }, + "Module '{0}' declares '{1}' locally, but it is exported as '{2}'.": { + "category": "Error", + "code": 2460 + }, + "Type '{0}' is not an array type.": { + "category": "Error", + "code": 2461 + }, + "A rest element must be last in a destructuring pattern.": { + "category": "Error", + "code": 2462 + }, + "A binding pattern parameter cannot be optional in an implementation signature.": { + "category": "Error", + "code": 2463 + }, + "A computed property name must be of type 'string', 'number', 'symbol', or 'any'.": { + "category": "Error", + "code": 2464 + }, + "'this' cannot be referenced in a computed property name.": { + "category": "Error", + "code": 2465 + }, + "'super' cannot be referenced in a computed property name.": { + "category": "Error", + "code": 2466 + }, + "A computed property name cannot reference a type parameter from its containing type.": { + "category": "Error", + "code": 2467 + }, + "Cannot find global value '{0}'.": { + "category": "Error", + "code": 2468 + }, + "The '{0}' operator cannot be applied to type 'symbol'.": { + "category": "Error", + "code": 2469 + }, + "'Symbol' reference does not refer to the global Symbol constructor object.": { + "category": "Error", + "code": 2470 + }, + "A computed property name of the form '{0}' must be of type 'symbol'.": { + "category": "Error", + "code": 2471 + }, + "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher.": { + "category": "Error", + "code": 2472 + }, + "Enum declarations must all be const or non-const.": { + "category": "Error", + "code": 2473 + }, + "const enum member initializers can only contain literal values and other computed enum values.": { + "category": "Error", + "code": 2474 + }, + "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query.": { + "category": "Error", + "code": 2475 + }, + "A const enum member can only be accessed using a string literal.": { + "category": "Error", + "code": 2476 + }, + "'const' enum member initializer was evaluated to a non-finite value.": { + "category": "Error", + "code": 2477 + }, + "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { + "category": "Error", + "code": 2478 + }, + "Property '{0}' does not exist on 'const' enum '{1}'.": { + "category": "Error", + "code": 2479 + }, + "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { + "category": "Error", + "code": 2480 + }, + "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { + "category": "Error", + "code": 2481 + }, + "The left-hand side of a 'for...of' statement cannot use a type annotation.": { + "category": "Error", + "code": 2483 + }, + "Export declaration conflicts with exported declaration of '{0}'.": { + "category": "Error", + "code": 2484 + }, + "The left-hand side of a 'for...of' statement must be a variable or a property access.": { + "category": "Error", + "code": 2487 + }, + "Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator.": { + "category": "Error", + "code": 2488 + }, + "An iterator must have a 'next()' method.": { + "category": "Error", + "code": 2489 + }, + "The type returned by the '{0}()' method of an iterator must have a 'value' property.": { + "category": "Error", + "code": 2490 + }, + "The left-hand side of a 'for...in' statement cannot be a destructuring pattern.": { + "category": "Error", + "code": 2491 + }, + "Cannot redeclare identifier '{0}' in catch clause.": { + "category": "Error", + "code": 2492 + }, + "Tuple type '{0}' of length '{1}' has no element at index '{2}'.": { + "category": "Error", + "code": 2493 + }, + "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.": { + "category": "Error", + "code": 2494 + }, + "Type '{0}' is not an array type or a string type.": { + "category": "Error", + "code": 2495 + }, + "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.": { + "category": "Error", + "code": 2496 + }, + "This module can only be referenced with ECMAScript imports/exports by turning on the '{0}' flag and referencing its default export.": { + "category": "Error", + "code": 2497 + }, + "Module '{0}' uses 'export =' and cannot be used with 'export *'.": { + "category": "Error", + "code": 2498 + }, + "An interface can only extend an identifier/qualified-name with optional type arguments.": { + "category": "Error", + "code": 2499 + }, + "A class can only implement an identifier/qualified-name with optional type arguments.": { + "category": "Error", + "code": 2500 + }, + "A rest element cannot contain a binding pattern.": { + "category": "Error", + "code": 2501 + }, + "'{0}' is referenced directly or indirectly in its own type annotation.": { + "category": "Error", + "code": 2502 + }, + "Cannot find namespace '{0}'.": { + "category": "Error", + "code": 2503 + }, + "Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.": { + "category": "Error", + "code": 2504 + }, + "A generator cannot have a 'void' type annotation.": { + "category": "Error", + "code": 2505 + }, + "'{0}' is referenced directly or indirectly in its own base expression.": { + "category": "Error", + "code": 2506 + }, + "Type '{0}' is not a constructor function type.": { + "category": "Error", + "code": 2507 + }, + "No base constructor has the specified number of type arguments.": { + "category": "Error", + "code": 2508 + }, + "Base constructor return type '{0}' is not an object type or intersection of object types with statically known members.": { + "category": "Error", + "code": 2509 + }, + "Base constructors must all have the same return type.": { + "category": "Error", + "code": 2510 + }, + "Cannot create an instance of an abstract class.": { + "category": "Error", + "code": 2511 + }, + "Overload signatures must all be abstract or non-abstract.": { + "category": "Error", + "code": 2512 + }, + "Abstract method '{0}' in class '{1}' cannot be accessed via super expression.": { + "category": "Error", + "code": 2513 + }, + "Classes containing abstract methods must be marked abstract.": { + "category": "Error", + "code": 2514 + }, + "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'.": { + "category": "Error", + "code": 2515 + }, + "All declarations of an abstract method must be consecutive.": { + "category": "Error", + "code": 2516 + }, + "Cannot assign an abstract constructor type to a non-abstract constructor type.": { + "category": "Error", + "code": 2517 + }, + "A 'this'-based type guard is not compatible with a parameter-based type guard.": { + "category": "Error", + "code": 2518 + }, + "An async iterator must have a 'next()' method.": { + "category": "Error", + "code": 2519 + }, + "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": { + "category": "Error", + "code": 2520 + }, + "Expression resolves to variable declaration '{0}' that compiler uses to support async functions.": { + "category": "Error", + "code": 2521 + }, + "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method.": { + "category": "Error", + "code": 2522 + }, + "'yield' expressions cannot be used in a parameter initializer.": { + "category": "Error", + "code": 2523 + }, + "'await' expressions cannot be used in a parameter initializer.": { + "category": "Error", + "code": 2524 + }, + "Initializer provides no value for this binding element and the binding element has no default value.": { + "category": "Error", + "code": 2525 + }, + "A 'this' type is available only in a non-static member of a class or interface.": { + "category": "Error", + "code": 2526 + }, + "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary.": { + "category": "Error", + "code": 2527 + }, + "A module cannot have multiple default exports.": { + "category": "Error", + "code": 2528 + }, + "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions.": { + "category": "Error", + "code": 2529 + }, + "Property '{0}' is incompatible with index signature.": { + "category": "Error", + "code": 2530 + }, + "Object is possibly 'null'.": { + "category": "Error", + "code": 2531 + }, + "Object is possibly 'undefined'.": { + "category": "Error", + "code": 2532 + }, + "Object is possibly 'null' or 'undefined'.": { + "category": "Error", + "code": 2533 + }, + "A function returning 'never' cannot have a reachable end point.": { + "category": "Error", + "code": 2534 + }, + "Enum type '{0}' has members with initializers that are not literals.": { + "category": "Error", + "code": 2535 + }, + "Type '{0}' cannot be used to index type '{1}'.": { + "category": "Error", + "code": 2536 + }, + "Type '{0}' has no matching index signature for type '{1}'.": { + "category": "Error", + "code": 2537 + }, + "Type '{0}' cannot be used as an index type.": { + "category": "Error", + "code": 2538 + }, + "Cannot assign to '{0}' because it is not a variable.": { + "category": "Error", + "code": 2539 + }, + "Cannot assign to '{0}' because it is a read-only property.": { + "category": "Error", + "code": 2540 + }, + "The target of an assignment must be a variable or a property access.": { + "category": "Error", + "code": 2541 + }, + "Index signature in type '{0}' only permits reading.": { + "category": "Error", + "code": 2542 + }, + "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference.": { + "category": "Error", + "code": 2543 + }, + "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference.": { + "category": "Error", + "code": 2544 + }, + "A mixin class must have a constructor with a single rest parameter of type 'any[]'.": { + "category": "Error", + "code": 2545 + }, + "The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property.": { + "category": "Error", + "code": 2547 + }, + "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator.": { + "category": "Error", + "code": 2548 + }, + "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator.": { + "category": "Error", + "code": 2549 + }, + "Property '{0}' does not exist on type '{1}'. Do you need to change your target library? Try changing the `lib` compiler option to '{2}' or later.": { + "category": "Error", + "code": 2550 + }, + "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?": { + "category": "Error", + "code": 2551 + }, + "Cannot find name '{0}'. Did you mean '{1}'?": { + "category": "Error", + "code": 2552 + }, + "Computed values are not permitted in an enum with string valued members.": { + "category": "Error", + "code": 2553 + }, + "Expected {0} arguments, but got {1}.": { + "category": "Error", + "code": 2554 + }, + "Expected at least {0} arguments, but got {1}.": { + "category": "Error", + "code": 2555 + }, + "Expected {0} arguments, but got {1} or more.": { + "category": "Error", + "code": 2556 + }, + "Expected at least {0} arguments, but got {1} or more.": { + "category": "Error", + "code": 2557 + }, + "Expected {0} type arguments, but got {1}.": { + "category": "Error", + "code": 2558 + }, + "Type '{0}' has no properties in common with type '{1}'.": { + "category": "Error", + "code": 2559 + }, + "Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?": { + "category": "Error", + "code": 2560 + }, + "Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?": { + "category": "Error", + "code": 2561 + }, + "Base class expressions cannot reference class type parameters.": { + "category": "Error", + "code": 2562 + }, + "The containing function or module body is too large for control flow analysis.": { + "category": "Error", + "code": 2563 + }, + "Property '{0}' has no initializer and is not definitely assigned in the constructor.": { + "category": "Error", + "code": 2564 + }, + "Property '{0}' is used before being assigned.": { + "category": "Error", + "code": 2565 + }, + "A rest element cannot have a property name.": { + "category": "Error", + "code": 2566 + }, + "Enum declarations can only merge with namespace or other enum declarations.": { + "category": "Error", + "code": 2567 + }, + "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.": { + "category": "Error", + "code": 2569 + }, + "Object is of type 'unknown'.": { + "category": "Error", + "code": 2571 + }, + "Rest signatures are incompatible.": { + "category": "Error", + "code": 2572 + }, + "Property '{0}' is incompatible with rest element type.": { + "category": "Error", + "code": 2573 + }, + "A rest element type must be an array type.": { + "category": "Error", + "code": 2574 + }, + "No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments.": { + "category": "Error", + "code": 2575 + }, + "Property '{0}' does not exist on type '{1}'. Did you mean to access the static member '{2}' instead?": { + "category": "Error", + "code": 2576 + }, + "Return type annotation circularly references itself.": { + "category": "Error", + "code": 2577 + }, + "Unused '@ts-expect-error' directive.": { + "category": "Error", + "code": 2578 + }, + "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.": { + "category": "Error", + "code": 2580 + }, + "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.": { + "category": "Error", + "code": 2581 + }, + "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.": { + "category": "Error", + "code": 2582 + }, + "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to '{1}' or later.": { + "category": "Error", + "code": 2583 + }, + "Cannot find name '{0}'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.": { + "category": "Error", + "code": 2584 + }, + "'{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.": { + "category": "Error", + "code": 2585 + }, + "Enum type '{0}' circularly references itself.": { + "category": "Error", + "code": 2586 + }, + "JSDoc type '{0}' circularly references itself.": { + "category": "Error", + "code": 2587 + }, + "Cannot assign to '{0}' because it is a constant.": { + "category": "Error", + "code": 2588 + }, + "Type instantiation is excessively deep and possibly infinite.": { + "category": "Error", + "code": 2589 + }, + "Expression produces a union type that is too complex to represent.": { + "category": "Error", + "code": 2590 + }, + "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add `node` to the types field in your tsconfig.": { + "category": "Error", + "code": 2591 + }, + "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add `jquery` to the types field in your tsconfig.": { + "category": "Error", + "code": 2592 + }, + "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig.": { + "category": "Error", + "code": 2593 + }, + "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag.": { + "category": "Error", + "code": 2594 + }, + "'{0}' can only be imported by using a default import.": { + "category": "Error", + "code": 2595 + }, + "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import.": { + "category": "Error", + "code": 2596 + }, + "'{0}' can only be imported by using a 'require' call or by using a default import.": { + "category": "Error", + "code": 2597 + }, + "'{0}' can only be imported by using a 'require' call or by turning on the 'esModuleInterop' flag and using a default import.": { + "category": "Error", + "code": 2598 + }, + "JSX element attributes type '{0}' may not be a union type.": { + "category": "Error", + "code": 2600 + }, + "The return type of a JSX element constructor must return an object type.": { + "category": "Error", + "code": 2601 + }, + "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist.": { + "category": "Error", + "code": 2602 + }, + "Property '{0}' in type '{1}' is not assignable to type '{2}'.": { + "category": "Error", + "code": 2603 + }, + "JSX element type '{0}' does not have any construct or call signatures.": { + "category": "Error", + "code": 2604 + }, + "JSX element type '{0}' is not a constructor function for JSX elements.": { + "category": "Error", + "code": 2605 + }, + "Property '{0}' of JSX spread attribute is not assignable to target property.": { + "category": "Error", + "code": 2606 + }, + "JSX element class does not support attributes because it does not have a '{0}' property.": { + "category": "Error", + "code": 2607 + }, + "The global type 'JSX.{0}' may not have more than one property.": { + "category": "Error", + "code": 2608 + }, + "JSX spread child must be an array type.": { + "category": "Error", + "code": 2609 + }, + "'{0}' is defined as an accessor in class '{1}', but is overridden here in '{2}' as an instance property.": { + "category": "Error", + "code": 2610 + }, + "'{0}' is defined as a property in class '{1}', but is overridden here in '{2}' as an accessor.": { + "category": "Error", + "code": 2611 + }, + "Property '{0}' will overwrite the base property in '{1}'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.": { + "category": "Error", + "code": 2612 + }, + "Module '{0}' has no default export. Did you mean to use 'import { {1} } from {0}' instead?": { + "category": "Error", + "code": 2613 + }, + "Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?": { + "category": "Error", + "code": 2614 + }, + "Type of property '{0}' circularly references itself in mapped type '{1}'.": { + "category": "Error", + "code": 2615 + }, + "'{0}' can only be imported by using 'import {1} = require({2})' or a default import.": { + "category": "Error", + "code": 2616 + }, + "'{0}' can only be imported by using 'import {1} = require({2})' or by turning on the 'esModuleInterop' flag and using a default import.": { + "category": "Error", + "code": 2617 + }, + "Source has {0} element(s) but target requires {1}.": { + "category": "Error", + "code": 2618 + }, + "Source has {0} element(s) but target allows only {1}.": { + "category": "Error", + "code": 2619 + }, + "Target requires {0} element(s) but source may have fewer.": { + "category": "Error", + "code": 2620 + }, + "Target allows only {0} element(s) but source may have more.": { + "category": "Error", + "code": 2621 + }, + "Element at index {0} is variadic in one type but not in the other.": { + "category": "Error", + "code": 2622 + }, + + "Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": { + "category": "Error", + "code": 2649 + }, + "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.": { + "category": "Error", + "code": 2651 + }, + "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.": { + "category": "Error", + "code": 2652 + }, + "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.": { + "category": "Error", + "code": 2653 + }, + "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": { + "category": "Error", + "code": 2654 + }, + "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": { + "category": "Error", + "code": 2656 + }, + "JSX expressions must have one parent element.": { + "category": "Error", + "code": 2657 + }, + "Type '{0}' provides no match for the signature '{1}'.": { + "category": "Error", + "code": 2658 + }, + "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher.": { + "category": "Error", + "code": 2659 + }, + "'super' can only be referenced in members of derived classes or object literal expressions.": { + "category": "Error", + "code": 2660 + }, + "Cannot export '{0}'. Only local declarations can be exported from a module.": { + "category": "Error", + "code": 2661 + }, + "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?": { + "category": "Error", + "code": 2662 + }, + "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?": { + "category": "Error", + "code": 2663 + }, + "Invalid module name in augmentation, module '{0}' cannot be found.": { + "category": "Error", + "code": 2664 + }, + "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented.": { + "category": "Error", + "code": 2665 + }, + "Exports and export assignments are not permitted in module augmentations.": { + "category": "Error", + "code": 2666 + }, + "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module.": { + "category": "Error", + "code": 2667 + }, + "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.": { + "category": "Error", + "code": 2668 + }, + "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.": { + "category": "Error", + "code": 2669 + }, + "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context.": { + "category": "Error", + "code": 2670 + }, + "Cannot augment module '{0}' because it resolves to a non-module entity.": { + "category": "Error", + "code": 2671 + }, + "Cannot assign a '{0}' constructor type to a '{1}' constructor type.": { + "category": "Error", + "code": 2672 + }, + "Constructor of class '{0}' is private and only accessible within the class declaration.": { + "category": "Error", + "code": 2673 + }, + "Constructor of class '{0}' is protected and only accessible within the class declaration.": { + "category": "Error", + "code": 2674 + }, + "Cannot extend a class '{0}'. Class constructor is marked as private.": { + "category": "Error", + "code": 2675 + }, + "Accessors must both be abstract or non-abstract.": { + "category": "Error", + "code": 2676 + }, + "A type predicate's type must be assignable to its parameter's type.": { + "category": "Error", + "code": 2677 + }, + "Type '{0}' is not comparable to type '{1}'.": { + "category": "Error", + "code": 2678 + }, + "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.": { + "category": "Error", + "code": 2679 + }, + "A '{0}' parameter must be the first parameter.": { + "category": "Error", + "code": 2680 + }, + "A constructor cannot have a 'this' parameter.": { + "category": "Error", + "code": 2681 + }, + "'get' and 'set' accessor must have the same 'this' type.": { + "category": "Error", + "code": 2682 + }, + "'this' implicitly has type 'any' because it does not have a type annotation.": { + "category": "Error", + "code": 2683 + }, + "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'.": { + "category": "Error", + "code": 2684 + }, + "The 'this' types of each signature are incompatible.": { + "category": "Error", + "code": 2685 + }, + "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead.": { + "category": "Error", + "code": 2686 + }, + "All declarations of '{0}' must have identical modifiers.": { + "category": "Error", + "code": 2687 + }, + "Cannot find type definition file for '{0}'.": { + "category": "Error", + "code": 2688 + }, + "Cannot extend an interface '{0}'. Did you mean 'implements'?": { + "category": "Error", + "code": 2689 + }, + "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?": { + "category": "Error", + "code": 2690 + }, + "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead.": { + "category": "Error", + "code": 2691 + }, + "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible.": { + "category": "Error", + "code": 2692 + }, + "'{0}' only refers to a type, but is being used as a value here.": { + "category": "Error", + "code": 2693 + }, + "Namespace '{0}' has no exported member '{1}'.": { + "category": "Error", + "code": 2694 + }, + "Left side of comma operator is unused and has no side effects.": { + "category": "Error", + "code": 2695, + "reportsUnnecessary": true + }, + "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?": { + "category": "Error", + "code": 2696 + }, + "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.": { + "category": "Error", + "code": 2697 + }, + "Spread types may only be created from object types.": { + "category": "Error", + "code": 2698 + }, + "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'.": { + "category": "Error", + "code": 2699 + }, + "Rest types may only be created from object types.": { + "category": "Error", + "code": 2700 + }, + "The target of an object rest assignment must be a variable or a property access.": { + "category": "Error", + "code": 2701 + }, + "'{0}' only refers to a type, but is being used as a namespace here.": { + "category": "Error", + "code": 2702 + }, + "The operand of a 'delete' operator must be a property reference.": { + "category": "Error", + "code": 2703 + }, + "The operand of a 'delete' operator cannot be a read-only property.": { + "category": "Error", + "code": 2704 + }, + "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.": { + "category": "Error", + "code": 2705 + }, + "Required type parameters may not follow optional type parameters.": { + "category": "Error", + "code": 2706 + }, + "Generic type '{0}' requires between {1} and {2} type arguments.": { + "category": "Error", + "code": 2707 + }, + "Cannot use namespace '{0}' as a value.": { + "category": "Error", + "code": 2708 + }, + "Cannot use namespace '{0}' as a type.": { + "category": "Error", + "code": 2709 + }, + "'{0}' are specified twice. The attribute named '{0}' will be overwritten.": { + "category": "Error", + "code": 2710 + }, + "A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.": { + "category": "Error", + "code": 2711 + }, + "A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.": { + "category": "Error", + "code": 2712 + }, + "Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}[\"{1}\"]'?": { + "category": "Error", + "code": 2713 + }, + "The expression of an export assignment must be an identifier or qualified name in an ambient context.": { + "category": "Error", + "code": 2714 + }, + "Abstract property '{0}' in class '{1}' cannot be accessed in the constructor.": { + "category": "Error", + "code": 2715 + }, + "Type parameter '{0}' has a circular default.": { + "category": "Error", + "code": 2716 + }, + "Subsequent property declarations must have the same type. Property '{0}' must be of type '{1}', but here has type '{2}'.": { + "category": "Error", + "code": 2717 + }, + "Duplicate property '{0}'.": { + "category": "Error", + "code": 2718 + }, + "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated.": { + "category": "Error", + "code": 2719 + }, + "Class '{0}' incorrectly implements class '{1}'. Did you mean to extend '{1}' and inherit its members as a subclass?": { + "category": "Error", + "code": 2720 + }, + "Cannot invoke an object which is possibly 'null'.": { + "category": "Error", + "code": 2721 + }, + "Cannot invoke an object which is possibly 'undefined'.": { + "category": "Error", + "code": 2722 + }, + "Cannot invoke an object which is possibly 'null' or 'undefined'.": { + "category": "Error", + "code": 2723 + }, + "'{0}' has no exported member named '{1}'. Did you mean '{2}'?": { + "category": "Error", + "code": 2724 + }, + "Class name cannot be 'Object' when targeting ES5 with module {0}.": { + "category": "Error", + "code": 2725 + }, + "Cannot find lib definition for '{0}'.": { + "category": "Error", + "code": 2726 + }, + "Cannot find lib definition for '{0}'. Did you mean '{1}'?": { + "category": "Error", + "code": 2727 + }, + "'{0}' is declared here.": { + "category": "Message", + "code": 2728 + }, + "Property '{0}' is used before its initialization.": { + "category": "Error", + "code": 2729 + }, + "An arrow function cannot have a 'this' parameter.": { + "category": "Error", + "code": 2730 + }, + "Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'.": { + "category": "Error", + "code": 2731 + }, + "Cannot find module '{0}'. Consider using '--resolveJsonModule' to import module with '.json' extension.": { + "category": "Error", + "code": 2732 + }, + "Property '{0}' was also declared here.": { + "category": "Error", + "code": 2733 + }, + "Are you missing a semicolon?": { + "category": "Error", + "code": 2734 + }, + "Did you mean for '{0}' to be constrained to type 'new (...args: any[]) => {1}'?": { + "category": "Error", + "code": 2735 + }, + "Operator '{0}' cannot be applied to type '{1}'.": { + "category": "Error", + "code": 2736 + }, + "BigInt literals are not available when targeting lower than ES2020.": { + "category": "Error", + "code": 2737 + }, + "An outer value of 'this' is shadowed by this container.": { + "category": "Message", + "code": 2738 + }, + "Type '{0}' is missing the following properties from type '{1}': {2}": { + "category": "Error", + "code": 2739 + }, + "Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more.": { + "category": "Error", + "code": 2740 + }, + "Property '{0}' is missing in type '{1}' but required in type '{2}'.": { + "category": "Error", + "code": 2741 + }, + "The inferred type of '{0}' cannot be named without a reference to '{1}'. This is likely not portable. A type annotation is necessary.": { + "category": "Error", + "code": 2742 + }, + "No overload expects {0} type arguments, but overloads do exist that expect either {1} or {2} type arguments.": { + "category": "Error", + "code": 2743 + }, + "Type parameter defaults can only reference previously declared type parameters.": { + "category": "Error", + "code": 2744 + }, + "This JSX tag's '{0}' prop expects type '{1}' which requires multiple children, but only a single child was provided.": { + "category": "Error", + "code": 2745 + }, + "This JSX tag's '{0}' prop expects a single child of type '{1}', but multiple children were provided.": { + "category": "Error", + "code": 2746 + }, + "'{0}' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of '{1}' is '{2}'.": { + "category": "Error", + "code": 2747 + }, + "Cannot access ambient const enums when the '--isolatedModules' flag is provided.": { + "category": "Error", + "code": 2748 + }, + "'{0}' refers to a value, but is being used as a type here. Did you mean 'typeof {0}'?": { + "category": "Error", + "code": 2749 + }, + "The implementation signature is declared here.": { + "category": "Error", + "code": 2750 + }, + "Circularity originates in type at this location.": { + "category": "Error", + "code": 2751 + }, + "The first export default is here.": { + "category": "Error", + "code": 2752 + }, + "Another export default is here.": { + "category": "Error", + "code": 2753 + }, + "'super' may not use type arguments.": { + "category": "Error", + "code": 2754 + }, + "No constituent of type '{0}' is callable.": { + "category": "Error", + "code": 2755 + }, + "Not all constituents of type '{0}' are callable.": { + "category": "Error", + "code": 2756 + }, + "Type '{0}' has no call signatures.": { + "category": "Error", + "code": 2757 + }, + "Each member of the union type '{0}' has signatures, but none of those signatures are compatible with each other.": { + "category": "Error", + "code": 2758 + }, + "No constituent of type '{0}' is constructable.": { + "category": "Error", + "code": 2759 + }, + "Not all constituents of type '{0}' are constructable.": { + "category": "Error", + "code": 2760 + }, + "Type '{0}' has no construct signatures.": { + "category": "Error", + "code": 2761 + }, + "Each member of the union type '{0}' has construct signatures, but none of those signatures are compatible with each other.": { + "category": "Error", + "code": 2762 + }, + "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'.": { + "category": "Error", + "code": 2763 + }, + "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'.": { + "category": "Error", + "code": 2764 + }, + "Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'.": { + "category": "Error", + "code": 2765 + }, + "Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'.": { + "category": "Error", + "code": 2766 + }, + "The '{0}' property of an iterator must be a method.": { + "category": "Error", + "code": 2767 + }, + "The '{0}' property of an async iterator must be a method.": { + "category": "Error", + "code": 2768 + }, + "No overload matches this call.": { + "category": "Error", + "code": 2769 + }, + "The last overload gave the following error.": { + "category": "Error", + "code": 2770 + }, + "The last overload is declared here.": { + "category": "Error", + "code": 2771 + }, + "Overload {0} of {1}, '{2}', gave the following error.": { + "category": "Error", + "code": 2772 + }, + "Did you forget to use 'await'?": { + "category": "Error", + "code": 2773 + }, + "This condition will always return true since the function is always defined. Did you mean to call it instead?": { + "category": "Error", + "code": 2774 + }, + "Assertions require every name in the call target to be declared with an explicit type annotation.": { + "category": "Error", + "code": 2775 + }, + "Assertions require the call target to be an identifier or qualified name.": { + "category": "Error", + "code": 2776 + }, + "The operand of an increment or decrement operator may not be an optional property access.": { + "category": "Error", + "code": 2777 + }, + "The target of an object rest assignment may not be an optional property access.": { + "category": "Error", + "code": 2778 + }, + "The left-hand side of an assignment expression may not be an optional property access.": { + "category": "Error", + "code": 2779 + }, + "The left-hand side of a 'for...in' statement may not be an optional property access.": { + "category": "Error", + "code": 2780 + }, + "The left-hand side of a 'for...of' statement may not be an optional property access.": { + "category": "Error", + "code": 2781 + }, + "'{0}' needs an explicit type annotation.": { + "category": "Message", + "code": 2782 + }, + "'{0}' is specified more than once, so this usage will be overwritten.": { + "category": "Error", + "code": 2783 + }, + "'get' and 'set' accessors cannot declare 'this' parameters.": { + "category": "Error", + "code": 2784 + }, + "This spread always overwrites this property.": { + "category": "Error", + "code": 2785 + }, + "'{0}' cannot be used as a JSX component.": { + "category": "Error", + "code": 2786 + }, + "Its return type '{0}' is not a valid JSX element.": { + "category": "Error", + "code": 2787 + }, + "Its instance type '{0}' is not a valid JSX element.": { + "category": "Error", + "code": 2788 + }, + "Its element type '{0}' is not a valid JSX element.": { + "category": "Error", + "code": 2789 + }, + "The operand of a 'delete' operator must be optional.": { + "category": "Error", + "code": 2790 + }, + "Exponentiation cannot be performed on 'bigint' values unless the 'target' option is set to 'es2016' or later.": { + "category": "Error", + "code": 2791 + }, + "Cannot find module '{0}'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?": { + "category": "Error", + "code": 2792 + }, + "The call would have succeeded against this implementation, but implementation signatures of overloads are not externally visible.": { + "category": "Error", + "code": 2793 + }, + "Expected {0} arguments, but got {1}. Did you forget to include 'void' in your type argument to 'Promise'?": { + "category": "Error", + "code": 2794 + }, + "The 'intrinsic' keyword can only be used to declare compiler provided intrinsic types.": { + "category": "Error", + "code": 2795 + }, + "It is likely that you are missing a comma to separate these two template expressions. They form a tagged template expression which cannot be invoked.": { + "category": "Error", + "code": 2796 + }, + + "Import declaration '{0}' is using private name '{1}'.": { + "category": "Error", + "code": 4000 + }, + "Type parameter '{0}' of exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4002 + }, + "Type parameter '{0}' of exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4004 + }, + "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4006 + }, + "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4008 + }, + "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4010 + }, + "Type parameter '{0}' of public method from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4012 + }, + "Type parameter '{0}' of method from exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4014 + }, + "Type parameter '{0}' of exported function has or is using private name '{1}'.": { + "category": "Error", + "code": 4016 + }, + "Implements clause of exported class '{0}' has or is using private name '{1}'.": { + "category": "Error", + "code": 4019 + }, + "'extends' clause of exported class '{0}' has or is using private name '{1}'.": { + "category": "Error", + "code": 4020 + }, + "'extends' clause of exported class has or is using private name '{0}'.": { + "category": "Error", + "code": 4021 + }, + "'extends' clause of exported interface '{0}' has or is using private name '{1}'.": { + "category": "Error", + "code": 4022 + }, + "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4023 + }, + "Exported variable '{0}' has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4024 + }, + "Exported variable '{0}' has or is using private name '{1}'.": { + "category": "Error", + "code": 4025 + }, + "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4026 + }, + "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4027 + }, + "Public static property '{0}' of exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4028 + }, + "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4029 + }, + "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4030 + }, + "Public property '{0}' of exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4031 + }, + "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4032 + }, + "Property '{0}' of exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4033 + }, + "Parameter type of public static setter '{0}' from exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4034 + }, + "Parameter type of public static setter '{0}' from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4035 + }, + "Parameter type of public setter '{0}' from exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4036 + }, + "Parameter type of public setter '{0}' from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4037 + }, + "Return type of public static getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4038 + }, + "Return type of public static getter '{0}' from exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4039 + }, + "Return type of public static getter '{0}' from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4040 + }, + "Return type of public getter '{0}' from exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4041 + }, + "Return type of public getter '{0}' from exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4042 + }, + "Return type of public getter '{0}' from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4043 + }, + "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'.": { + "category": "Error", + "code": 4044 + }, + "Return type of constructor signature from exported interface has or is using private name '{0}'.": { + "category": "Error", + "code": 4045 + }, + "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'.": { + "category": "Error", + "code": 4046 + }, + "Return type of call signature from exported interface has or is using private name '{0}'.": { + "category": "Error", + "code": 4047 + }, + "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'.": { + "category": "Error", + "code": 4048 + }, + "Return type of index signature from exported interface has or is using private name '{0}'.": { + "category": "Error", + "code": 4049 + }, + "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named.": { + "category": "Error", + "code": 4050 + }, + "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'.": { + "category": "Error", + "code": 4051 + }, + "Return type of public static method from exported class has or is using private name '{0}'.": { + "category": "Error", + "code": 4052 + }, + "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named.": { + "category": "Error", + "code": 4053 + }, + "Return type of public method from exported class has or is using name '{0}' from private module '{1}'.": { + "category": "Error", + "code": 4054 + }, + "Return type of public method from exported class has or is using private name '{0}'.": { + "category": "Error", + "code": 4055 + }, + "Return type of method from exported interface has or is using name '{0}' from private module '{1}'.": { + "category": "Error", + "code": 4056 + }, + "Return type of method from exported interface has or is using private name '{0}'.": { + "category": "Error", + "code": 4057 + }, + "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named.": { + "category": "Error", + "code": 4058 + }, + "Return type of exported function has or is using name '{0}' from private module '{1}'.": { + "category": "Error", + "code": 4059 + }, + "Return type of exported function has or is using private name '{0}'.": { + "category": "Error", + "code": 4060 + }, + "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4061 + }, + "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4062 + }, + "Parameter '{0}' of constructor from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4063 + }, + "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4064 + }, + "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4065 + }, + "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4066 + }, + "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4067 + }, + "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4068 + }, + "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4069 + }, + "Parameter '{0}' of public static method from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4070 + }, + "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4071 + }, + "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4072 + }, + "Parameter '{0}' of public method from exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4073 + }, + "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4074 + }, + "Parameter '{0}' of method from exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4075 + }, + "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4076 + }, + "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4077 + }, + "Parameter '{0}' of exported function has or is using private name '{1}'.": { + "category": "Error", + "code": 4078 + }, + "Exported type alias '{0}' has or is using private name '{1}'.": { + "category": "Error", + "code": 4081 + }, + "Default export of the module has or is using private name '{0}'.": { + "category": "Error", + "code": 4082 + }, + "Type parameter '{0}' of exported type alias has or is using private name '{1}'.": { + "category": "Error", + "code": 4083 + }, + "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.": { + "category": "Error", + "code": 4090 + }, + "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4091 + }, + "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4092 + }, + "Property '{0}' of exported class expression may not be private or protected.": { + "category": "Error", + "code": 4094 + }, + "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4095 + }, + "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4096 + }, + "Public static method '{0}' of exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4097 + }, + "Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4098 + }, + "Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4099 + }, + "Public method '{0}' of exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4100 + }, + "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4101 + }, + "Method '{0}' of exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4102 + }, + "Type parameter '{0}' of exported mapped object type is using private name '{1}'.": { + "category": "Error", + "code": 4103 + }, + "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'.": { + "category": "Error", + "code": 4104 + }, + "Private or protected member '{0}' cannot be accessed on a type parameter.": { + "category": "Error", + "code": 4105 + }, + "Parameter '{0}' of accessor has or is using private name '{1}'.": { + "category": "Error", + "code": 4106 + }, + "Parameter '{0}' of accessor has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4107 + }, + "Parameter '{0}' of accessor has or is using name '{1}' from external module '{2}' but cannot be named.": { + "category": "Error", + "code": 4108 + }, + "Type arguments for '{0}' circularly reference themselves.": { + "category": "Error", + "code": 4109 + }, + "Tuple type arguments circularly reference themselves.": { + "category": "Error", + "code": 4110 + }, + "Property '{0}' comes from an index signature, so it must be accessed with ['{0}'].": { + "category": "Error", + "code": 4111 + }, + "This member cannot have an 'override' modifier because its containing class '{0}' does not extend another class.": { + "category": "Error", + "code": 4112 + }, + "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'.": { + "category": "Error", + "code": 4113 + }, + "This member must have an 'override' modifier because it overrides a member in the base class '{0}'.": { + "category": "Error", + "code": 4114 + }, + "This parameter property must be rewritten as a property declaration with an 'override' modifier because it overrides a member in base class '{0}'.": { + "category": "Error", + "code": 4115 + }, + "This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class '{0}'.": { + "category": "Error", + "code": 4116 + }, + + "The current host does not support the '{0}' option.": { + "category": "Error", + "code": 5001 + }, + "Cannot find the common subdirectory path for the input files.": { + "category": "Error", + "code": 5009 + }, + "File specification cannot end in a recursive directory wildcard ('**'): '{0}'.": { + "category": "Error", + "code": 5010 + }, + "Cannot read file '{0}': {1}.": { + "category": "Error", + "code": 5012 + }, + "Failed to parse file '{0}': {1}.": { + "category": "Error", + "code": 5014 + }, + "Unknown compiler option '{0}'.": { + "category": "Error", + "code": 5023 + }, + "Compiler option '{0}' requires a value of type {1}.": { + "category": "Error", + "code": 5024 + }, + "Unknown compiler option '{0}'. Did you mean '{1}'?": { + "category": "Error", + "code": 5025 + }, + "Could not write file '{0}': {1}.": { + "category": "Error", + "code": 5033 + }, + "Option 'project' cannot be mixed with source files on a command line.": { + "category": "Error", + "code": 5042 + }, + "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher.": { + "category": "Error", + "code": 5047 + }, + "Option '{0}' cannot be specified when option 'target' is 'ES3'.": { + "category": "Error", + "code": 5048 + }, + "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": { + "category": "Error", + "code": 5051 + }, + "Option '{0}' cannot be specified without specifying option '{1}'.": { + "category": "Error", + "code": 5052 + }, + "Option '{0}' cannot be specified with option '{1}'.": { + "category": "Error", + "code": 5053 + }, + "A 'tsconfig.json' file is already defined at: '{0}'.": { + "category": "Error", + "code": 5054 + }, + "Cannot write file '{0}' because it would overwrite input file.": { + "category": "Error", + "code": 5055 + }, + "Cannot write file '{0}' because it would be overwritten by multiple input files.": { + "category": "Error", + "code": 5056 + }, + "Cannot find a tsconfig.json file at the specified directory: '{0}'.": { + "category": "Error", + "code": 5057 + }, + "The specified path does not exist: '{0}'.": { + "category": "Error", + "code": 5058 + }, + "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier.": { + "category": "Error", + "code": 5059 + }, + "Pattern '{0}' can have at most one '*' character.": { + "category": "Error", + "code": 5061 + }, + "Substitution '{0}' in pattern '{1}' can have at most one '*' character.": { + "category": "Error", + "code": 5062 + }, + "Substitutions for pattern '{0}' should be an array.": { + "category": "Error", + "code": 5063 + }, + "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'.": { + "category": "Error", + "code": 5064 + }, + "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'.": { + "category": "Error", + "code": 5065 + }, + "Substitutions for pattern '{0}' shouldn't be an empty array.": { + "category": "Error", + "code": 5066 + }, + "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name.": { + "category": "Error", + "code": 5067 + }, + "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig.": { + "category": "Error", + "code": 5068 + }, + "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'.": { + "category": "Error", + "code": 5069 + }, + "Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy.": { + "category": "Error", + "code": 5070 + }, + "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'.": { + "category": "Error", + "code": 5071 + }, + "Unknown build option '{0}'.": { + "category": "Error", + "code": 5072 + }, + "Build option '{0}' requires a value of type {1}.": { + "category": "Error", + "code": 5073 + }, + "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified.": { + "category": "Error", + "code": 5074 + }, + "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'.": { + "category": "Error", + "code": 5075 + }, + "'{0}' and '{1}' operations cannot be mixed without parentheses.": { + "category": "Error", + "code": 5076 + }, + "Unknown build option '{0}'. Did you mean '{1}'?": { + "category": "Error", + "code": 5077 + }, + "Unknown watch option '{0}'.": { + "category": "Error", + "code": 5078 + }, + "Unknown watch option '{0}'. Did you mean '{1}'?": { + "category": "Error", + "code": 5079 + }, + "Watch option '{0}' requires a value of type {1}.": { + "category": "Error", + "code": 5080 + }, + "Cannot find a tsconfig.json file at the current directory: {0}.": { + "category": "Error", + "code": 5081 + }, + "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'.": { + "category": "Error", + "code": 5082 + }, + "Cannot read file '{0}'.": { + "category": "Error", + "code": 5083 + }, + "Tuple members must all have names or all not have names.": { + "category": "Error", + "code": 5084 + }, + "A tuple member cannot be both optional and rest.": { + "category": "Error", + "code": 5085 + }, + "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type.": { + "category": "Error", + "code": 5086 + }, + "A labeled tuple element is declared as rest with a `...` before the name, rather than before the type.": { + "category": "Error", + "code": 5087 + }, + "The inferred type of '{0}' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary.": { + "category": "Error", + "code": 5088 + }, + "Option '{0}' cannot be specified when option 'jsx' is '{1}'.": { + "category": "Error", + "code": 5089 + }, + "Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?": { + "category": "Error", + "code": 5090 + }, + + "Generates a sourcemap for each corresponding '.d.ts' file.": { + "category": "Message", + "code": 6000 + }, + "Concatenate and emit output to single file.": { + "category": "Message", + "code": 6001 + }, + "Generates corresponding '.d.ts' file.": { + "category": "Message", + "code": 6002 + }, + "Specify the location where debugger should locate map files instead of generated locations.": { + "category": "Message", + "code": 6003 + }, + "Specify the location where debugger should locate TypeScript files instead of source locations.": { + "category": "Message", + "code": 6004 + }, + "Watch input files.": { + "category": "Message", + "code": 6005 + }, + "Redirect output structure to the directory.": { + "category": "Message", + "code": 6006 + }, + "Do not erase const enum declarations in generated code.": { + "category": "Message", + "code": 6007 + }, + "Do not emit outputs if any errors were reported.": { + "category": "Message", + "code": 6008 + }, + "Do not emit comments to output.": { + "category": "Message", + "code": 6009 + }, + "Do not emit outputs.": { + "category": "Message", + "code": 6010 + }, + "Allow default imports from modules with no default export. This does not affect code emit, just typechecking.": { + "category": "Message", + "code": 6011 + }, + "Skip type checking of declaration files.": { + "category": "Message", + "code": 6012 + }, + "Do not resolve the real path of symlinks.": { + "category": "Message", + "code": 6013 + }, + "Only emit '.d.ts' declaration files.": { + "category": "Message", + "code": 6014 + }, + "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'.": { + "category": "Message", + "code": 6015 + }, + "Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'.": { + "category": "Message", + "code": 6016 + }, + "Print this message.": { + "category": "Message", + "code": 6017 + }, + "Print the compiler's version.": { + "category": "Message", + "code": 6019 + }, + "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.": { + "category": "Message", + "code": 6020 + }, + "Syntax: {0}": { + "category": "Message", + "code": 6023 + }, + "options": { + "category": "Message", + "code": 6024 + }, + "file": { + "category": "Message", + "code": 6025 + }, + "Examples: {0}": { + "category": "Message", + "code": 6026 + }, + "Options:": { + "category": "Message", + "code": 6027 + }, + "Version {0}": { + "category": "Message", + "code": 6029 + }, + "Insert command line options and files from a file.": { + "category": "Message", + "code": 6030 + }, + "Starting compilation in watch mode...": { + "category": "Message", + "code": 6031 + }, + "File change detected. Starting incremental compilation...": { + "category": "Message", + "code": 6032 + }, + "KIND": { + "category": "Message", + "code": 6034 + }, + "FILE": { + "category": "Message", + "code": 6035 + }, + "VERSION": { + "category": "Message", + "code": 6036 + }, + "LOCATION": { + "category": "Message", + "code": 6037 + }, + "DIRECTORY": { + "category": "Message", + "code": 6038 + }, + "STRATEGY": { + "category": "Message", + "code": 6039 + }, + "FILE OR DIRECTORY": { + "category": "Message", + "code": 6040 + }, + "Generates corresponding '.map' file.": { + "category": "Message", + "code": 6043 + }, + "Compiler option '{0}' expects an argument.": { + "category": "Error", + "code": 6044 + }, + "Unterminated quoted string in response file '{0}'.": { + "category": "Error", + "code": 6045 + }, + "Argument for '{0}' option must be: {1}.": { + "category": "Error", + "code": 6046 + }, + "Locale must be of the form or -. For example '{0}' or '{1}'.": { + "category": "Error", + "code": 6048 + }, + "Unsupported locale '{0}'.": { + "category": "Error", + "code": 6049 + }, + "Unable to open file '{0}'.": { + "category": "Error", + "code": 6050 + }, + "Corrupted locale file {0}.": { + "category": "Error", + "code": 6051 + }, + "Raise error on expressions and declarations with an implied 'any' type.": { + "category": "Message", + "code": 6052 + }, + "File '{0}' not found.": { + "category": "Error", + "code": 6053 + }, + "File '{0}' has an unsupported extension. The only supported extensions are {1}.": { + "category": "Error", + "code": 6054 + }, + "Suppress noImplicitAny errors for indexing objects lacking index signatures.": { + "category": "Message", + "code": 6055 + }, + "Do not emit declarations for code that has an '@internal' annotation.": { + "category": "Message", + "code": 6056 + }, + "Specify the root directory of input files. Use to control the output directory structure with --outDir.": { + "category": "Message", + "code": 6058 + }, + "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files.": { + "category": "Error", + "code": 6059 + }, + "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).": { + "category": "Message", + "code": 6060 + }, + "NEWLINE": { + "category": "Message", + "code": 6061 + }, + "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'null' on command line.": { + "category": "Error", + "code": 6064 + }, + "Enables experimental support for ES7 decorators.": { + "category": "Message", + "code": 6065 + }, + "Enables experimental support for emitting type metadata for decorators.": { + "category": "Message", + "code": 6066 + }, + "Enables experimental support for ES7 async functions.": { + "category": "Message", + "code": 6068 + }, + "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).": { + "category": "Message", + "code": 6069 + }, + "Initializes a TypeScript project and creates a tsconfig.json file.": { + "category": "Message", + "code": 6070 + }, + "Successfully created a tsconfig.json file.": { + "category": "Message", + "code": 6071 + }, + "Suppress excess property checks for object literals.": { + "category": "Message", + "code": 6072 + }, + "Stylize errors and messages using color and context (experimental).": { + "category": "Message", + "code": 6073 + }, + "Do not report errors on unused labels.": { + "category": "Message", + "code": 6074 + }, + "Report error when not all code paths in function return a value.": { + "category": "Message", + "code": 6075 + }, + "Report errors for fallthrough cases in switch statement.": { + "category": "Message", + "code": 6076 + }, + "Do not report errors on unreachable code.": { + "category": "Message", + "code": 6077 + }, + "Disallow inconsistently-cased references to the same file.": { + "category": "Message", + "code": 6078 + }, + "Specify library files to be included in the compilation.": { + "category": "Message", + "code": 6079 + }, + "Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'.": { + "category": "Message", + "code": 6080 + }, + "File '{0}' has an unsupported extension, so skipping it.": { + "category": "Message", + "code": 6081 + }, + "Only 'amd' and 'system' modules are supported alongside --{0}.": { + "category": "Error", + "code": 6082 + }, + "Base directory to resolve non-absolute module names.": { + "category": "Message", + "code": 6083 + }, + "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit": { + "category": "Message", + "code": 6084 + }, + "Enable tracing of the name resolution process.": { + "category": "Message", + "code": 6085 + }, + "======== Resolving module '{0}' from '{1}'. ========": { + "category": "Message", + "code": 6086 + }, + "Explicitly specified module resolution kind: '{0}'.": { + "category": "Message", + "code": 6087 + }, + "Module resolution kind is not specified, using '{0}'.": { + "category": "Message", + "code": 6088 + }, + "======== Module name '{0}' was successfully resolved to '{1}'. ========": { + "category": "Message", + "code": 6089 + }, + "======== Module name '{0}' was not resolved. ========": { + "category": "Message", + "code": 6090 + }, + "'paths' option is specified, looking for a pattern to match module name '{0}'.": { + "category": "Message", + "code": 6091 + }, + "Module name '{0}', matched pattern '{1}'.": { + "category": "Message", + "code": 6092 + }, + "Trying substitution '{0}', candidate module location: '{1}'.": { + "category": "Message", + "code": 6093 + }, + "Resolving module name '{0}' relative to base url '{1}' - '{2}'.": { + "category": "Message", + "code": 6094 + }, + "Loading module as file / folder, candidate module location '{0}', target file type '{1}'.": { + "category": "Message", + "code": 6095 + }, + "File '{0}' does not exist.": { + "category": "Message", + "code": 6096 + }, + "File '{0}' exist - use it as a name resolution result.": { + "category": "Message", + "code": 6097 + }, + "Loading module '{0}' from 'node_modules' folder, target file type '{1}'.": { + "category": "Message", + "code": 6098 + }, + "Found 'package.json' at '{0}'.": { + "category": "Message", + "code": 6099 + }, + "'package.json' does not have a '{0}' field.": { + "category": "Message", + "code": 6100 + }, + "'package.json' has '{0}' field '{1}' that references '{2}'.": { + "category": "Message", + "code": 6101 + }, + "Allow javascript files to be compiled.": { + "category": "Message", + "code": 6102 + }, + "Option '{0}' should have array of strings as a value.": { + "category": "Error", + "code": 6103 + }, + "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'.": { + "category": "Message", + "code": 6104 + }, + "Expected type of '{0}' field in 'package.json' to be '{1}', got '{2}'.": { + "category": "Message", + "code": 6105 + }, + "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'.": { + "category": "Message", + "code": 6106 + }, + "'rootDirs' option is set, using it to resolve relative module name '{0}'.": { + "category": "Message", + "code": 6107 + }, + "Longest matching prefix for '{0}' is '{1}'.": { + "category": "Message", + "code": 6108 + }, + "Loading '{0}' from the root dir '{1}', candidate location '{2}'.": { + "category": "Message", + "code": 6109 + }, + "Trying other entries in 'rootDirs'.": { + "category": "Message", + "code": 6110 + }, + "Module resolution using 'rootDirs' has failed.": { + "category": "Message", + "code": 6111 + }, + "Do not emit 'use strict' directives in module output.": { + "category": "Message", + "code": 6112 + }, + "Enable strict null checks.": { + "category": "Message", + "code": 6113 + }, + "Unknown option 'excludes'. Did you mean 'exclude'?": { + "category": "Error", + "code": 6114 + }, + "Raise error on 'this' expressions with an implied 'any' type.": { + "category": "Message", + "code": 6115 + }, + "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========": { + "category": "Message", + "code": 6116 + }, + "Resolving using primary search paths...": { + "category": "Message", + "code": 6117 + }, + "Resolving from node_modules folder...": { + "category": "Message", + "code": 6118 + }, + "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========": { + "category": "Message", + "code": 6119 + }, + "======== Type reference directive '{0}' was not resolved. ========": { + "category": "Message", + "code": 6120 + }, + "Resolving with primary search path '{0}'.": { + "category": "Message", + "code": 6121 + }, + "Root directory cannot be determined, skipping primary search paths.": { + "category": "Message", + "code": 6122 + }, + "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========": { + "category": "Message", + "code": 6123 + }, + "Type declaration files to be included in compilation.": { + "category": "Message", + "code": 6124 + }, + "Looking up in 'node_modules' folder, initial location '{0}'.": { + "category": "Message", + "code": 6125 + }, + "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder.": { + "category": "Message", + "code": 6126 + }, + "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========": { + "category": "Message", + "code": 6127 + }, + "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========": { + "category": "Message", + "code": 6128 + }, + "Resolving real path for '{0}', result '{1}'.": { + "category": "Message", + "code": 6130 + }, + "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'.": { + "category": "Error", + "code": 6131 + }, + "File name '{0}' has a '{1}' extension - stripping it.": { + "category": "Message", + "code": 6132 + }, + "'{0}' is declared but its value is never read.": { + "category": "Error", + "code": 6133, + "reportsUnnecessary": true + }, + "Report errors on unused locals.": { + "category": "Message", + "code": 6134 + }, + "Report errors on unused parameters.": { + "category": "Message", + "code": 6135 + }, + "The maximum dependency depth to search under node_modules and load JavaScript files.": { + "category": "Message", + "code": 6136 + }, + "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'.": { + "category": "Error", + "code": 6137 + }, + "Property '{0}' is declared but its value is never read.": { + "category": "Error", + "code": 6138, + "reportsUnnecessary": true + }, + "Import emit helpers from 'tslib'.": { + "category": "Message", + "code": 6139 + }, + "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'.": { + "category": "Error", + "code": 6140 + }, + "Parse in strict mode and emit \"use strict\" for each source file.": { + "category": "Message", + "code": 6141 + }, + "Module '{0}' was resolved to '{1}', but '--jsx' is not set.": { + "category": "Error", + "code": 6142 + }, + "Module '{0}' was resolved as locally declared ambient module in file '{1}'.": { + "category": "Message", + "code": 6144 + }, + "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified.": { + "category": "Message", + "code": 6145 + }, + "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'.": { + "category": "Message", + "code": 6146 + }, + "Resolution for module '{0}' was found in cache from location '{1}'.": { + "category": "Message", + "code": 6147 + }, + "Directory '{0}' does not exist, skipping all lookups in it.": { + "category": "Message", + "code": 6148 + }, + "Show diagnostic information.": { + "category": "Message", + "code": 6149 + }, + "Show verbose diagnostic information.": { + "category": "Message", + "code": 6150 + }, + "Emit a single file with source maps instead of having a separate file.": { + "category": "Message", + "code": 6151 + }, + "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set.": { + "category": "Message", + "code": 6152 + }, + "Transpile each file as a separate module (similar to 'ts.transpileModule').": { + "category": "Message", + "code": 6153 + }, + "Print names of generated files part of the compilation.": { + "category": "Message", + "code": 6154 + }, + "Print names of files part of the compilation.": { + "category": "Message", + "code": 6155 + }, + "The locale used when displaying messages to the user (e.g. 'en-us')": { + "category": "Message", + "code": 6156 + }, + "Do not generate custom helper functions like '__extends' in compiled output.": { + "category": "Message", + "code": 6157 + }, + "Do not include the default library file (lib.d.ts).": { + "category": "Message", + "code": 6158 + }, + "Do not add triple-slash references or imported modules to the list of compiled files.": { + "category": "Message", + "code": 6159 + }, + "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files.": { + "category": "Message", + "code": 6160 + }, + "List of folders to include type definitions from.": { + "category": "Message", + "code": 6161 + }, + "Disable size limitations on JavaScript projects.": { + "category": "Message", + "code": 6162 + }, + "The character set of the input files.": { + "category": "Message", + "code": 6163 + }, + "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.": { + "category": "Message", + "code": 6164 + }, + "Do not truncate error messages.": { + "category": "Message", + "code": 6165 + }, + "Output directory for generated declaration files.": { + "category": "Message", + "code": 6166 + }, + "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'.": { + "category": "Message", + "code": 6167 + }, + "List of root folders whose combined content represents the structure of the project at runtime.": { + "category": "Message", + "code": 6168 + }, + "Show all compiler options.": { + "category": "Message", + "code": 6169 + }, + "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file": { + "category": "Message", + "code": 6170 + }, + "Command-line Options": { + "category": "Message", + "code": 6171 + }, + "Basic Options": { + "category": "Message", + "code": 6172 + }, + "Strict Type-Checking Options": { + "category": "Message", + "code": 6173 + }, + "Module Resolution Options": { + "category": "Message", + "code": 6174 + }, + "Source Map Options": { + "category": "Message", + "code": 6175 + }, + "Additional Checks": { + "category": "Message", + "code": 6176 + }, + "Experimental Options": { + "category": "Message", + "code": 6177 + }, + "Advanced Options": { + "category": "Message", + "code": 6178 + }, + "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'.": { + "category": "Message", + "code": 6179 + }, + "Enable all strict type-checking options.": { + "category": "Message", + "code": 6180 + }, + "List of language service plugins.": { + "category": "Message", + "code": 6181 + }, + "Scoped package detected, looking in '{0}'": { + "category": "Message", + "code": 6182 + }, + "Reusing resolution of module '{0}' to file '{1}' from old program.": { + "category": "Message", + "code": 6183 + }, + "Reusing module resolutions originating in '{0}' since resolutions are unchanged from old program.": { + "category": "Message", + "code": 6184 + }, + "Disable strict checking of generic signatures in function types.": { + "category": "Message", + "code": 6185 + }, + "Enable strict checking of function types.": { + "category": "Message", + "code": 6186 + }, + "Enable strict checking of property initialization in classes.": { + "category": "Message", + "code": 6187 + }, + "Numeric separators are not allowed here.": { + "category": "Error", + "code": 6188 + }, + "Multiple consecutive numeric separators are not permitted.": { + "category": "Error", + "code": 6189 + }, + "Whether to keep outdated console output in watch mode instead of clearing the screen.": { + "category": "Message", + "code": 6191 + }, + "All imports in import declaration are unused.": { + "category": "Error", + "code": 6192, + "reportsUnnecessary": true + }, + "Found 1 error. Watching for file changes.": { + "category": "Message", + "code": 6193 + }, + "Found {0} errors. Watching for file changes.": { + "category": "Message", + "code": 6194 + }, + "Resolve 'keyof' to string valued property names only (no numbers or symbols).": { + "category": "Message", + "code": 6195 + }, + "'{0}' is declared but never used.": { + "category": "Error", + "code": 6196, + "reportsUnnecessary": true + }, + "Include modules imported with '.json' extension": { + "category": "Message", + "code": 6197 + }, + "All destructured elements are unused.": { + "category": "Error", + "code": 6198, + "reportsUnnecessary": true + }, + "All variables are unused.": { + "category": "Error", + "code": 6199, + "reportsUnnecessary": true + }, + "Definitions of the following identifiers conflict with those in another file: {0}": { + "category": "Error", + "code": 6200 + }, + "Conflicts are in this file.": { + "category": "Message", + "code": 6201 + }, + "Project references may not form a circular graph. Cycle detected: {0}": { + "category": "Error", + "code": 6202 + }, + "'{0}' was also declared here.": { + "category": "Message", + "code": 6203 + }, + "and here.": { + "category": "Message", + "code": 6204 + }, + "All type parameters are unused.": { + "category": "Error", + "code": 6205 + }, + "'package.json' has a 'typesVersions' field with version-specific path mappings.": { + "category": "Message", + "code": 6206 + }, + "'package.json' does not have a 'typesVersions' entry that matches version '{0}'.": { + "category": "Message", + "code": 6207 + }, + "'package.json' has a 'typesVersions' entry '{0}' that matches compiler version '{1}', looking for a pattern to match module name '{2}'.": { + "category": "Message", + "code": 6208 + }, + "'package.json' has a 'typesVersions' entry '{0}' that is not a valid semver range.": { + "category": "Message", + "code": 6209 + }, + "An argument for '{0}' was not provided.": { + "category": "Message", + "code": 6210 + }, + "An argument matching this binding pattern was not provided.": { + "category": "Message", + "code": 6211 + }, + "Did you mean to call this expression?": { + "category": "Message", + "code": 6212 + }, + "Did you mean to use 'new' with this expression?": { + "category": "Message", + "code": 6213 + }, + "Enable strict 'bind', 'call', and 'apply' methods on functions.": { + "category": "Message", + "code": 6214 + }, + "Using compiler options of project reference redirect '{0}'.": { + "category": "Message", + "code": 6215 + }, + "Found 1 error.": { + "category": "Message", + "code": 6216 + }, + "Found {0} errors.": { + "category": "Message", + "code": 6217 + }, + "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========": { + "category": "Message", + "code": 6218 + }, + "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========": { + "category": "Message", + "code": 6219 + }, + "'package.json' had a falsy '{0}' field.": { + "category": "Message", + "code": 6220 + }, + "Disable use of source files instead of declaration files from referenced projects.": { + "category": "Message", + "code": 6221 + }, + "Emit class fields with Define instead of Set.": { + "category": "Message", + "code": 6222 + }, + "Generates a CPU profile.": { + "category": "Message", + "code": 6223 + }, + "Disable solution searching for this project.": { + "category": "Message", + "code": 6224 + }, + "Specify strategy for watching file: 'FixedPollingInterval' (default), 'PriorityPollingInterval', 'DynamicPriorityPolling', 'UseFsEvents', 'UseFsEventsOnParentDirectory'.": { + "category": "Message", + "code": 6225 + }, + "Specify strategy for watching directory on platforms that don't support recursive watching natively: 'UseFsEvents' (default), 'FixedPollingInterval', 'DynamicPriorityPolling'.": { + "category": "Message", + "code": 6226 + }, + "Specify strategy for creating a polling watch when it fails to create using file system events: 'FixedInterval' (default), 'PriorityInterval', 'DynamicPriority'.": { + "category": "Message", + "code": 6227 + }, + "Synchronously call callbacks and update the state of directory watchers on platforms that don't support recursive watching natively.": { + "category": "Message", + "code": 6228 + }, + "Tag '{0}' expects at least '{1}' arguments, but the JSX factory '{2}' provides at most '{3}'.": { + "category": "Error", + "code": 6229 + }, + "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'false' or 'null' on command line.": { + "category": "Error", + "code": 6230 + }, + "Could not resolve the path '{0}' with the extensions: {1}.": { + "category": "Error", + "code": 6231 + }, + "Declaration augments declaration in another file. This cannot be serialized.": { + "category": "Error", + "code": 6232 + }, + "This is the declaration being augmented. Consider moving the augmenting declaration into the same file.": { + "category": "Error", + "code": 6233 + }, + "This expression is not callable because it is a 'get' accessor. Did you mean to use it without '()'?": { + "category": "Error", + "code": 6234 + }, + "Disable loading referenced projects.": { + "category": "Message", + "code": 6235 + }, + "Arguments for the rest parameter '{0}' were not provided.": { + "category": "Error", + "code": 6236 + }, + "Generates an event trace and a list of types.": { + "category": "Message", + "code": 6237 + }, + "Specify the module specifier to be used to import the `jsx` and `jsxs` factory functions from. eg, react": { + "category": "Error", + "code": 6238 + }, + + "Projects to reference": { + "category": "Message", + "code": 6300 + }, + "Enable project compilation": { + "category": "Message", + "code": 6302 + }, + + "Composite projects may not disable declaration emit.": { + "category": "Error", + "code": 6304 + }, + "Output file '{0}' has not been built from source file '{1}'.": { + "category": "Error", + "code": 6305 + }, + "Referenced project '{0}' must have setting \"composite\": true.": { + "category": "Error", + "code": 6306 + }, + "File '{0}' is not listed within the file list of project '{1}'. Projects must list all files or use an 'include' pattern.": { + "category": "Error", + "code": 6307 + }, + "Cannot prepend project '{0}' because it does not have 'outFile' set": { + "category": "Error", + "code": 6308 + }, + "Output file '{0}' from project '{1}' does not exist": { + "category": "Error", + "code": 6309 + }, + "Referenced project '{0}' may not disable emit.": { + "category": "Error", + "code": 6310 + }, + "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'": { + "category": "Message", + "code": 6350 + }, + "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'": { + "category": "Message", + "code": 6351 + }, + "Project '{0}' is out of date because output file '{1}' does not exist": { + "category": "Message", + "code": 6352 + }, + "Project '{0}' is out of date because its dependency '{1}' is out of date": { + "category": "Message", + "code": 6353 + }, + "Project '{0}' is up to date with .d.ts files from its dependencies": { + "category": "Message", + "code": 6354 + }, + "Projects in this build: {0}": { + "category": "Message", + "code": 6355 + }, + "A non-dry build would delete the following files: {0}": { + "category": "Message", + "code": 6356 + }, + "A non-dry build would build project '{0}'": { + "category": "Message", + "code": 6357 + }, + "Building project '{0}'...": { + "category": "Message", + "code": 6358 + }, + "Updating output timestamps of project '{0}'...": { + "category": "Message", + "code": 6359 + }, + "delete this - Project '{0}' is up to date because it was previously built": { + "category": "Message", + "code": 6360 + }, + "Project '{0}' is up to date": { + "category": "Message", + "code": 6361 + }, + "Skipping build of project '{0}' because its dependency '{1}' has errors": { + "category": "Message", + "code": 6362 + }, + "Project '{0}' can't be built because its dependency '{1}' has errors": { + "category": "Message", + "code": 6363 + }, + "Build one or more projects and their dependencies, if out of date": { + "category": "Message", + "code": 6364 + }, + "Delete the outputs of all projects": { + "category": "Message", + "code": 6365 + }, + "Enable verbose logging": { + "category": "Message", + "code": 6366 + }, + "Show what would be built (or deleted, if specified with '--clean')": { + "category": "Message", + "code": 6367 + }, + "Build all projects, including those that appear to be up to date": { + "category": "Message", + "code": 6368 + }, + "Option '--build' must be the first command line argument.": { + "category": "Error", + "code": 6369 + }, + "Options '{0}' and '{1}' cannot be combined.": { + "category": "Error", + "code": 6370 + }, + "Updating unchanged output timestamps of project '{0}'...": { + "category": "Message", + "code": 6371 + }, + "Project '{0}' is out of date because output of its dependency '{1}' has changed": { + "category": "Message", + "code": 6372 + }, + "Updating output of project '{0}'...": { + "category": "Message", + "code": 6373 + }, + "A non-dry build would update timestamps for output of project '{0}'": { + "category": "Message", + "code": 6374 + }, + "A non-dry build would update output of project '{0}'": { + "category": "Message", + "code": 6375 + }, + "Cannot update output of project '{0}' because there was error reading file '{1}'": { + "category": "Message", + "code": 6376 + }, + "Cannot write file '{0}' because it will overwrite '.tsbuildinfo' file generated by referenced project '{1}'": { + "category": "Error", + "code": 6377 + }, + "Enable incremental compilation": { + "category": "Message", + "code": 6378 + }, + "Composite projects may not disable incremental compilation.": { + "category": "Error", + "code": 6379 + }, + "Specify file to store incremental compilation information": { + "category": "Message", + "code": 6380 + }, + "Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'": { + "category": "Message", + "code": 6381 + }, + "Skipping build of project '{0}' because its dependency '{1}' was not built": { + "category": "Message", + "code": 6382 + }, + "Project '{0}' can't be built because its dependency '{1}' was not built": { + "category": "Message", + "code": 6383 + }, + "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.": { + "category": "Message", + "code": 6384 + }, + "'{0}' is deprecated": { + "category": "Suggestion", + "code": 6385, + "reportsDeprecated": true + }, + "Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found.": { + "category": "Message", + "code": 6386 + }, + + "The expected type comes from property '{0}' which is declared here on type '{1}'": { + "category": "Message", + "code": 6500 + }, + "The expected type comes from this index signature.": { + "category": "Message", + "code": 6501 + }, + "The expected type comes from the return type of this signature.": { + "category": "Message", + "code": 6502 + }, + "Print names of files that are part of the compilation and then stop processing.": { + "category": "Message", + "code": 6503 + }, + "File '{0}' is a JavaScript file. Did you mean to enable the 'allowJs' option?": { + "category": "Error", + "code": 6504 + }, + "Print names of files and the reason they are part of the compilation.": { + "category": "Message", + "code": 6505 + }, + "Require undeclared properties from index signatures to use element accesses.": { + "category": "Error", + "code": 6803 + }, + + "Include 'undefined' in index signature results": { + "category": "Message", + "code": 6800 + }, + "Force overriding members in derived classes to be marked with an 'override' modifier.": { + "category": "Error", + "code": 6801 + }, + "Require undeclared properties from index signatures to use element accesses.": { + "category": "Error", + "code": 6803 + }, + + "Variable '{0}' implicitly has an '{1}' type.": { + "category": "Error", + "code": 7005 + }, + "Parameter '{0}' implicitly has an '{1}' type.": { + "category": "Error", + "code": 7006 + }, + "Member '{0}' implicitly has an '{1}' type.": { + "category": "Error", + "code": 7008 + }, + "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.": { + "category": "Error", + "code": 7009 + }, + "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type.": { + "category": "Error", + "code": 7010 + }, + "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type.": { + "category": "Error", + "code": 7011 + }, + "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.": { + "category": "Error", + "code": 7013 + }, + "Function type, which lacks return-type annotation, implicitly has an '{0}' return type.": { + "category": "Error", + "code": 7014 + }, + "Element implicitly has an 'any' type because index expression is not of type 'number'.": { + "category": "Error", + "code": 7015 + }, + "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type.": { + "category": "Error", + "code": 7016 + }, + "Element implicitly has an 'any' type because type '{0}' has no index signature.": { + "category": "Error", + "code": 7017 + }, + "Object literal's property '{0}' implicitly has an '{1}' type.": { + "category": "Error", + "code": 7018 + }, + "Rest parameter '{0}' implicitly has an 'any[]' type.": { + "category": "Error", + "code": 7019 + }, + "Call signature, which lacks return-type annotation, implicitly has an 'any' return type.": { + "category": "Error", + "code": 7020 + }, + "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.": { + "category": "Error", + "code": 7022 + }, + "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.": { + "category": "Error", + "code": 7023 + }, + "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.": { + "category": "Error", + "code": 7024 + }, + "Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation.": { + "category": "Error", + "code": 7025 + }, + "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists.": { + "category": "Error", + "code": 7026 + }, + "Unreachable code detected.": { + "category": "Error", + "code": 7027, + "reportsUnnecessary": true + }, + "Unused label.": { + "category": "Error", + "code": 7028, + "reportsUnnecessary": true + }, + "Fallthrough case in switch.": { + "category": "Error", + "code": 7029 + }, + "Not all code paths return a value.": { + "category": "Error", + "code": 7030 + }, + "Binding element '{0}' implicitly has an '{1}' type.": { + "category": "Error", + "code": 7031 + }, + "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation.": { + "category": "Error", + "code": 7032 + }, + "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation.": { + "category": "Error", + "code": 7033 + }, + "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined.": { + "category": "Error", + "code": 7034 + }, + "Try `npm i --save-dev @types/{1}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`": { + "category": "Error", + "code": 7035 + }, + "Dynamic import's specifier must be of type 'string', but here has type '{0}'.": { + "category": "Error", + "code": 7036 + }, + "Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'.": { + "category": "Message", + "code": 7037 + }, + "Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.": { + "category": "Message", + "code": 7038 + }, + "Mapped object type implicitly has an 'any' template type.": { + "category": "Error", + "code": 7039 + }, + "If the '{0}' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/{1}`": { + "category": "Error", + "code": 7040 + }, + "The containing arrow function captures the global value of 'this'.": { + "category": "Error", + "code": 7041 + }, + "Module '{0}' was resolved to '{1}', but '--resolveJsonModule' is not used.": { + "category": "Error", + "code": 7042 + }, + "Variable '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage.": { + "category": "Suggestion", + "code": 7043 + }, + "Parameter '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage.": { + "category": "Suggestion", + "code": 7044 + }, + "Member '{0}' implicitly has an '{1}' type, but a better type may be inferred from usage.": { + "category": "Suggestion", + "code": 7045 + }, + "Variable '{0}' implicitly has type '{1}' in some locations, but a better type may be inferred from usage.": { + "category": "Suggestion", + "code": 7046 + }, + "Rest parameter '{0}' implicitly has an 'any[]' type, but a better type may be inferred from usage.": { + "category": "Suggestion", + "code": 7047 + }, + "Property '{0}' implicitly has type 'any', but a better type for its get accessor may be inferred from usage.": { + "category": "Suggestion", + "code": 7048 + }, + "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage.": { + "category": "Suggestion", + "code": 7049 + }, + "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage.": { + "category": "Suggestion", + "code": 7050 + }, + "Parameter has a name but no type. Did you mean '{0}: {1}'?": { + "category": "Error", + "code": 7051 + }, + "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}'?": { + "category": "Error", + "code": 7052 + }, + "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'.": { + "category": "Error", + "code": 7053 + }, + "No index signature with a parameter of type '{0}' was found on type '{1}'.": { + "category": "Error", + "code": 7054 + }, + "'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type.": { + "category": "Error", + "code": 7055 + }, + "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.": { + "category": "Error", + "code": 7056 + }, + "'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation.": { + "category": "Error", + "code": 7057 + }, + + "You cannot rename this element.": { + "category": "Error", + "code": 8000 + }, + "You cannot rename elements that are defined in the standard TypeScript library.": { + "category": "Error", + "code": 8001 + }, + "'import ... =' can only be used in TypeScript files.": { + "category": "Error", + "code": 8002 + }, + "'export =' can only be used in TypeScript files.": { + "category": "Error", + "code": 8003 + }, + "Type parameter declarations can only be used in TypeScript files.": { + "category": "Error", + "code": 8004 + }, + "'implements' clauses can only be used in TypeScript files.": { + "category": "Error", + "code": 8005 + }, + "'{0}' declarations can only be used in TypeScript files.": { + "category": "Error", + "code": 8006 + }, + "Type aliases can only be used in TypeScript files.": { + "category": "Error", + "code": 8008 + }, + "The '{0}' modifier can only be used in TypeScript files.": { + "category": "Error", + "code": 8009 + }, + "Type annotations can only be used in TypeScript files.": { + "category": "Error", + "code": 8010 + }, + "Type arguments can only be used in TypeScript files.": { + "category": "Error", + "code": 8011 + }, + "Parameter modifiers can only be used in TypeScript files.": { + "category": "Error", + "code": 8012 + }, + "Non-null assertions can only be used in TypeScript files.": { + "category": "Error", + "code": 8013 + }, + "Type assertion expressions can only be used in TypeScript files.": { + "category": "Error", + "code": 8016 + }, + "Octal literal types must use ES2015 syntax. Use the syntax '{0}'.": { + "category": "Error", + "code": 8017 + }, + "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'.": { + "category": "Error", + "code": 8018 + }, + "Report errors in .js files.": { + "category": "Message", + "code": 8019 + }, + "JSDoc types can only be used inside documentation comments.": { + "category": "Error", + "code": 8020 + }, + "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags.": { + "category": "Error", + "code": 8021 + }, + "JSDoc '@{0}' is not attached to a class.": { + "category": "Error", + "code": 8022 + }, + "JSDoc '@{0} {1}' does not match the 'extends {2}' clause.": { + "category": "Error", + "code": 8023 + }, + "JSDoc '@param' tag has name '{0}', but there is no parameter with that name.": { + "category": "Error", + "code": 8024 + }, + "Class declarations cannot have more than one `@augments` or `@extends` tag.": { + "category": "Error", + "code": 8025 + }, + "Expected {0} type arguments; provide these with an '@extends' tag.": { + "category": "Error", + "code": 8026 + }, + "Expected {0}-{1} type arguments; provide these with an '@extends' tag.": { + "category": "Error", + "code": 8027 + }, + "JSDoc '...' may only appear in the last parameter of a signature.": { + "category": "Error", + "code": 8028 + }, + "JSDoc '@param' tag has name '{0}', but there is no parameter with that name. It would match 'arguments' if it had an array type.": { + "category": "Error", + "code": 8029 + }, + "The type of a function declaration must match the function's signature.": { + "category": "Error", + "code": 8030 + }, + "You cannot rename a module via a global import.": { + "category": "Error", + "code": 8031 + }, + "Qualified name '{0}' is not allowed without a leading '@param {object} {1}'.": { + "category": "Error", + "code": 8032 + }, + "A JSDoc '@typedef' comment may not contain multiple '@type' tags.": { + "category": "Error", + "code": 8033 + }, + "The tag was first specified here.": { + "category": "Error", + "code": 8034 + }, + "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": { + "category": "Error", + "code": 9002 + }, + "'class' expressions are not currently supported.": { + "category": "Error", + "code": 9003 + }, + "Language service is disabled.": { + "category": "Error", + "code": 9004 + }, + "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit.": { + "category": "Error", + "code": 9005 + }, + "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit.": { + "category": "Error", + "code": 9006 + }, + "JSX attributes must only be assigned a non-empty 'expression'.": { + "category": "Error", + "code": 17000 + }, + "JSX elements cannot have multiple attributes with the same name.": { + "category": "Error", + "code": 17001 + }, + "Expected corresponding JSX closing tag for '{0}'.": { + "category": "Error", + "code": 17002 + }, + "JSX attribute expected.": { + "category": "Error", + "code": 17003 + }, + "Cannot use JSX unless the '--jsx' flag is provided.": { + "category": "Error", + "code": 17004 + }, + "A constructor cannot contain a 'super' call when its class extends 'null'.": { + "category": "Error", + "code": 17005 + }, + "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": { + "category": "Error", + "code": 17006 + }, + "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": { + "category": "Error", + "code": 17007 + }, + "JSX element '{0}' has no corresponding closing tag.": { + "category": "Error", + "code": 17008 + }, + "'super' must be called before accessing 'this' in the constructor of a derived class.": { + "category": "Error", + "code": 17009 + }, + "Unknown type acquisition option '{0}'.": { + "category": "Error", + "code": 17010 + }, + "'super' must be called before accessing a property of 'super' in the constructor of a derived class.": { + "category": "Error", + "code": 17011 + }, + "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?": { + "category": "Error", + "code": 17012 + }, + "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor.": { + "category": "Error", + "code": 17013 + }, + "JSX fragment has no corresponding closing tag.": { + "category": "Error", + "code": 17014 + }, + "Expected corresponding closing tag for JSX fragment.": { + "category": "Error", + "code": 17015 + }, + "The 'jsxFragmentFactory' compiler option must be provided to use JSX fragments with the 'jsxFactory' compiler option.": { + "category": "Error", + "code": 17016 + }, + "An @jsxFrag pragma is required when using an @jsx pragma with JSX fragments.": { + "category": "Error", + "code": 17017 + }, + "Unknown type acquisition option '{0}'. Did you mean '{1}'?": { + "category": "Error", + "code": 17018 + }, + "Circularity detected while resolving configuration: {0}": { + "category": "Error", + "code": 18000 + }, + "A path in an 'extends' option must be relative or rooted, but '{0}' is not.": { + "category": "Error", + "code": 18001 + }, + "The 'files' list in config file '{0}' is empty.": { + "category": "Error", + "code": 18002 + }, + "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'.": { + "category": "Error", + "code": 18003 + }, + + "File is a CommonJS module; it may be converted to an ES6 module.": { + "category": "Suggestion", + "code": 80001 + }, + "This constructor function may be converted to a class declaration.": { + "category": "Suggestion", + "code": 80002 + }, + "Import may be converted to a default import.": { + "category": "Suggestion", + "code": 80003 + }, + "JSDoc types may be moved to TypeScript types.": { + "category": "Suggestion", + "code": 80004 + }, + "'require' call may be converted to an import.": { + "category": "Suggestion", + "code": 80005 + }, + "This may be converted to an async function.": { + "category": "Suggestion", + "code": 80006 + }, + "'await' has no effect on the type of this expression.": { + "category": "Suggestion", + "code": 80007 + }, + "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers.": { + "category": "Suggestion", + "code": 80008 + }, + + "Add missing 'super()' call": { + "category": "Message", + "code": 90001 + }, + "Make 'super()' call the first statement in the constructor": { + "category": "Message", + "code": 90002 + }, + "Change 'extends' to 'implements'": { + "category": "Message", + "code": 90003 + }, + "Remove unused declaration for: '{0}'": { + "category": "Message", + "code": 90004 + }, + "Remove import from '{0}'": { + "category": "Message", + "code": 90005 + }, + "Implement interface '{0}'": { + "category": "Message", + "code": 90006 + }, + "Implement inherited abstract class": { + "category": "Message", + "code": 90007 + }, + "Add '{0}.' to unresolved variable": { + "category": "Message", + "code": 90008 + }, + "Remove variable statement": { + "category": "Message", + "code": 90010 + }, + "Remove template tag": { + "category": "Message", + "code": 90011 + }, + "Remove type parameters": { + "category": "Message", + "code": 90012 + }, + "Import '{0}' from module \"{1}\"": { + "category": "Message", + "code": 90013 + }, + "Change '{0}' to '{1}'": { + "category": "Message", + "code": 90014 + }, + "Add '{0}' to existing import declaration from \"{1}\"": { + "category": "Message", + "code": 90015 + }, + "Declare property '{0}'": { + "category": "Message", + "code": 90016 + }, + "Add index signature for property '{0}'": { + "category": "Message", + "code": 90017 + }, + "Disable checking for this file": { + "category": "Message", + "code": 90018 + }, + "Ignore this error message": { + "category": "Message", + "code": 90019 + }, + "Initialize property '{0}' in the constructor": { + "category": "Message", + "code": 90020 + }, + "Initialize static property '{0}'": { + "category": "Message", + "code": 90021 + }, + "Change spelling to '{0}'": { + "category": "Message", + "code": 90022 + }, + "Declare method '{0}'": { + "category": "Message", + "code": 90023 + }, + "Declare static method '{0}'": { + "category": "Message", + "code": 90024 + }, + "Prefix '{0}' with an underscore": { + "category": "Message", + "code": 90025 + }, + "Rewrite as the indexed access type '{0}'": { + "category": "Message", + "code": 90026 + }, + "Declare static property '{0}'": { + "category": "Message", + "code": 90027 + }, + "Call decorator expression": { + "category": "Message", + "code": 90028 + }, + "Add async modifier to containing function": { + "category": "Message", + "code": 90029 + }, + "Replace 'infer {0}' with 'unknown'": { + "category": "Message", + "code": 90030 + }, + "Replace all unused 'infer' with 'unknown'": { + "category": "Message", + "code": 90031 + }, + "Import default '{0}' from module \"{1}\"": { + "category": "Message", + "code": 90032 + }, + "Add default import '{0}' to existing import declaration from \"{1}\"": { + "category": "Message", + "code": 90033 + }, + "Add parameter name": { + "category": "Message", + "code": 90034 + }, + "Declare private property '{0}'": { + "category": "Message", + "code": 90035 + }, + "Replace '{0}' with 'Promise<{1}>'": { + "category": "Message", + "code": 90036 + }, + "Fix all incorrect return type of an async functions": { + "category": "Message", + "code": 90037 + }, + "Declare private method '{0}'": { + "category": "Message", + "code": 90038 + }, + "Remove unused destructuring declaration": { + "category": "Message", + "code": 90039 + }, + "Remove unused declarations for: '{0}'": { + "category": "Message", + "code": 90041 + }, + "Declare a private field named '{0}'.": { + "category": "Message", + "code": 90053 + }, + "Convert function to an ES2015 class": { + "category": "Message", + "code": 95001 + }, + "Convert function '{0}' to class": { + "category": "Message", + "code": 95002 + }, + "Convert '{0}' to '{1} in {0}'": { + "category": "Message", + "code": 95003 + }, + "Extract to {0} in {1}": { + "category": "Message", + "code": 95004 + }, + "Extract function": { + "category": "Message", + "code": 95005 + }, + "Extract constant": { + "category": "Message", + "code": 95006 + }, + "Extract to {0} in enclosing scope": { + "category": "Message", + "code": 95007 + }, + "Extract to {0} in {1} scope": { + "category": "Message", + "code": 95008 + }, + "Annotate with type from JSDoc": { + "category": "Message", + "code": 95009 + }, + "Annotate with types from JSDoc": { + "category": "Message", + "code": 95010 + }, + "Infer type of '{0}' from usage": { + "category": "Message", + "code": 95011 + }, + "Infer parameter types from usage": { + "category": "Message", + "code": 95012 + }, + "Convert to default import": { + "category": "Message", + "code": 95013 + }, + "Install '{0}'": { + "category": "Message", + "code": 95014 + }, + "Replace import with '{0}'.": { + "category": "Message", + "code": 95015 + }, + "Use synthetic 'default' member.": { + "category": "Message", + "code": 95016 + }, + "Convert to ES6 module": { + "category": "Message", + "code": 95017 + }, + "Add 'undefined' type to property '{0}'": { + "category": "Message", + "code": 95018 + }, + "Add initializer to property '{0}'": { + "category": "Message", + "code": 95019 + }, + "Add definite assignment assertion to property '{0}'": { + "category": "Message", + "code": 95020 + }, + "Convert all type literals to mapped type": { + "category": "Message", + "code": 95021 + }, + "Add all missing members": { + "category": "Message", + "code": 95022 + }, + "Infer all types from usage": { + "category": "Message", + "code": 95023 + }, + "Delete all unused declarations": { + "category": "Message", + "code": 95024 + }, + "Prefix all unused declarations with '_' where possible": { + "category": "Message", + "code": 95025 + }, + "Fix all detected spelling errors": { + "category": "Message", + "code": 95026 + }, + "Add initializers to all uninitialized properties": { + "category": "Message", + "code": 95027 + }, + "Add definite assignment assertions to all uninitialized properties": { + "category": "Message", + "code": 95028 + }, + "Add undefined type to all uninitialized properties": { + "category": "Message", + "code": 95029 + }, + "Change all jsdoc-style types to TypeScript": { + "category": "Message", + "code": 95030 + }, + "Change all jsdoc-style types to TypeScript (and add '| undefined' to nullable types)": { + "category": "Message", + "code": 95031 + }, + "Implement all unimplemented interfaces": { + "category": "Message", + "code": 95032 + }, + "Install all missing types packages": { + "category": "Message", + "code": 95033 + }, + "Rewrite all as indexed access types": { + "category": "Message", + "code": 95034 + }, + "Convert all to default imports": { + "category": "Message", + "code": 95035 + }, + "Make all 'super()' calls the first statement in their constructor": { + "category": "Message", + "code": 95036 + }, + "Add qualifier to all unresolved variables matching a member name": { + "category": "Message", + "code": 95037 + }, + "Change all extended interfaces to 'implements'": { + "category": "Message", + "code": 95038 + }, + "Add all missing super calls": { + "category": "Message", + "code": 95039 + }, + "Implement all inherited abstract classes": { + "category": "Message", + "code": 95040 + }, + "Add all missing 'async' modifiers": { + "category": "Message", + "code": 95041 + }, + "Add '@ts-ignore' to all error messages": { + "category": "Message", + "code": 95042 + }, + "Annotate everything with types from JSDoc": { + "category": "Message", + "code": 95043 + }, + "Add '()' to all uncalled decorators": { + "category": "Message", + "code": 95044 + }, + "Convert all constructor functions to classes": { + "category": "Message", + "code": 95045 + }, + "Generate 'get' and 'set' accessors": { + "category": "Message", + "code": 95046 + }, + "Convert 'require' to 'import'": { + "category": "Message", + "code": 95047 + }, + "Convert all 'require' to 'import'": { + "category": "Message", + "code": 95048 + }, + "Move to a new file": { + "category": "Message", + "code": 95049 + }, + "Remove unreachable code": { + "category": "Message", + "code": 95050 + }, + "Remove all unreachable code": { + "category": "Message", + "code": 95051 + }, + "Add missing 'typeof'": { + "category": "Message", + "code": 95052 + }, + "Remove unused label": { + "category": "Message", + "code": 95053 + }, + "Remove all unused labels": { + "category": "Message", + "code": 95054 + }, + "Convert '{0}' to mapped object type": { + "category": "Message", + "code": 95055 + }, + "Convert namespace import to named imports": { + "category": "Message", + "code": 95056 + }, + "Convert named imports to namespace import": { + "category": "Message", + "code": 95057 + }, + "Add or remove braces in an arrow function": { + "category": "Message", + "code": 95058 + }, + "Add braces to arrow function": { + "category": "Message", + "code": 95059 + }, + "Remove braces from arrow function": { + "category": "Message", + "code": 95060 + }, + "Convert default export to named export": { + "category": "Message", + "code": 95061 + }, + "Convert named export to default export": { + "category": "Message", + "code": 95062 + }, + "Add missing enum member '{0}'": { + "category": "Message", + "code": 95063 + }, + "Add all missing imports": { + "category": "Message", + "code": 95064 + }, + "Convert to async function": { + "category": "Message", + "code": 95065 + }, + "Convert all to async functions": { + "category": "Message", + "code": 95066 + }, + "Add missing call parentheses": { + "category": "Message", + "code": 95067 + }, + "Add all missing call parentheses": { + "category": "Message", + "code": 95068 + }, + "Add 'unknown' conversion for non-overlapping types": { + "category": "Message", + "code": 95069 + }, + "Add 'unknown' to all conversions of non-overlapping types": { + "category": "Message", + "code": 95070 + }, + "Add missing 'new' operator to call": { + "category": "Message", + "code": 95071 + }, + "Add missing 'new' operator to all calls": { + "category": "Message", + "code": 95072 + }, + "Add names to all parameters without names": { + "category": "Message", + "code": 95073 + }, + "Enable the 'experimentalDecorators' option in your configuration file": { + "category": "Message", + "code": 95074 + }, + "Convert parameters to destructured object": { + "category": "Message", + "code": 95075 + }, + "Allow accessing UMD globals from modules.": { + "category": "Message", + "code": 95076 + }, + "Extract type": { + "category": "Message", + "code": 95077 + }, + "Extract to type alias": { + "category": "Message", + "code": 95078 + }, + "Extract to typedef": { + "category": "Message", + "code": 95079 + }, + "Infer 'this' type of '{0}' from usage": { + "category": "Message", + "code": 95080 + }, + "Add 'const' to unresolved variable": { + "category": "Message", + "code": 95081 + }, + "Add 'const' to all unresolved variables": { + "category": "Message", + "code": 95082 + }, + "Add 'await'": { + "category": "Message", + "code": 95083 + }, + "Add 'await' to initializer for '{0}'": { + "category": "Message", + "code": 95084 + }, + "Fix all expressions possibly missing 'await'": { + "category": "Message", + "code": 95085 + }, + "Remove unnecessary 'await'": { + "category": "Message", + "code": 95086 + }, + "Remove all unnecessary uses of 'await'": { + "category": "Message", + "code": 95087 + }, + "Enable the '--jsx' flag in your configuration file": { + "category": "Message", + "code": 95088 + }, + "Add 'await' to initializers": { + "category": "Message", + "code": 95089 + }, + "Extract to interface": { + "category": "Message", + "code": 95090 + }, + "Convert to a bigint numeric literal": { + "category": "Message", + "code": 95091 + }, + "Convert all to bigint numeric literals": { + "category": "Message", + "code": 95092 + }, + "Convert 'const' to 'let'": { + "category": "Message", + "code": 95093 + }, + "Prefix with 'declare'": { + "category": "Message", + "code": 95094 + }, + "Prefix all incorrect property declarations with 'declare'": { + "category": "Message", + "code": 95095 + }, + "Convert to template string": { + "category": "Message", + "code": 95096 + }, + "Add 'export {}' to make this file into a module": { + "category": "Message", + "code": 95097 + }, + "Set the 'target' option in your configuration file to '{0}'": { + "category": "Message", + "code": 95098 + }, + "Set the 'module' option in your configuration file to '{0}'": { + "category": "Message", + "code": 95099 + }, + "Convert invalid character to its html entity code": { + "category": "Message", + "code": 95100 + }, + "Convert all invalid characters to HTML entity code": { + "category": "Message", + "code": 95101 + }, + "Add '@class' tag": { + "category": "Message", + "code": 95102 + }, + "Add '@this' tag": { + "category": "Message", + "code": 95103 + }, + "Add 'this' parameter.": { + "category": "Message", + "code": 95104 + }, + "Convert function expression '{0}' to arrow function": { + "category": "Message", + "code": 95105 + }, + "Convert function declaration '{0}' to arrow function": { + "category": "Message", + "code": 95106 + }, + "Fix all implicit-'this' errors": { + "category": "Message", + "code": 95107 + }, + "Wrap invalid character in an expression container": { + "category": "Message", + "code": 95108 + }, + "Wrap all invalid characters in an expression container": { + "category": "Message", + "code": 95109 + }, + "Visit https://aka.ms/tsconfig.json to read more about this file": { + "category": "Message", + "code": 95110 + }, + "Add a return statement": { + "category": "Message", + "code": 95111 + }, + "Remove braces from arrow function body": { + "category": "Message", + "code": 95112 + }, + "Wrap the following body with parentheses which should be an object literal": { + "category": "Message", + "code": 95113 + }, + "Add all missing return statement": { + "category": "Message", + "code": 95114 + }, + "Remove braces from all arrow function bodies with relevant issues": { + "category": "Message", + "code": 95115 + }, + "Wrap all object literal with parentheses": { + "category": "Message", + "code": 95116 + }, + "Move labeled tuple element modifiers to labels": { + "category": "Message", + "code": 95117 + }, + "Convert overload list to single signature": { + "category": "Message", + "code": 95118 + }, + "Generate 'get' and 'set' accessors for all overriding properties": { + "category": "Message", + "code": 95119 + }, + "Wrap in JSX fragment": { + "category": "Message", + "code": 95120 + }, + "Wrap all unparented JSX in JSX fragment": { + "category": "Message", + "code": 95121 + }, + "Convert arrow function or function expression": { + "category": "Message", + "code": 95122 + }, + "Convert to anonymous function": { + "category": "Message", + "code": 95123 + }, + "Convert to named function": { + "category": "Message", + "code": 95124 + }, + "Convert to arrow function": { + "category": "Message", + "code": 95125 + }, + "Remove parentheses": { + "category": "Message", + "code": 95126 + }, + "Could not find a containing arrow function": { + "category": "Message", + "code": 95127 + }, + "Containing function is not an arrow function": { + "category": "Message", + "code": 95128 + }, + "Could not find export statement": { + "category": "Message", + "code": 95129 + }, + "This file already has a default export": { + "category": "Message", + "code": 95130 + }, + "Could not find import clause": { + "category": "Message", + "code": 95131 + }, + "Could not find namespace import or named imports": { + "category": "Message", + "code": 95132 + }, + "Selection is not a valid type node": { + "category": "Message", + "code": 95133 + }, + "No type could be extracted from this type node": { + "category": "Message", + "code": 95134 + }, + "Could not find property for which to generate accessor": { + "category": "Message", + "code": 95135 + }, + "Name is not valid": { + "category": "Message", + "code": 95136 + }, + "Can only convert property with modifier": { + "category": "Message", + "code": 95137 + }, + "Switch each misused '{0}' to '{1}'": { + "category": "Message", + "code": 95138 + }, + "Convert to optional chain expression": { + "category": "Message", + "code": 95139 + }, + "Could not find convertible access expression": { + "category": "Message", + "code": 95140 + }, + "Could not find matching access expressions": { + "category": "Message", + "code": 95141 + }, + "Can only convert logical AND access chains": { + "category": "Message", + "code": 95142 + }, + "Add 'void' to Promise resolved without a value": { + "category": "Message", + "code": 95143 + }, + "Add 'void' to all Promises resolved without a value": { + "category": "Message", + "code": 95144 + }, + + "Use element access for '{0}'": { + "category": "Message", + "code": 95145 + }, + "Use element access for all undeclared properties.": { + "category": "Message", + "code": 95146 + }, + "Delete all unused imports": { + "category": "Message", + "code": 95147 + }, + "Infer function return type": { + "category": "Message", + "code": 95148 + }, + + "Return type must be inferred from a function": { + "category": "Message", + "code": 95149 + }, + "Could not determine function return type": { + "category": "Message", + "code": 95150 + }, + "Could not convert to arrow function": { + "category": "Message", + "code": 95151 + }, + "Could not convert to named function": { + "category": "Message", + "code": 95152 + }, + "Could not convert to anonymous function": { + "category": "Message", + "code": 95153 + }, + "Can only convert string concatenation": { + "category": "Message", + "code": 95154 + }, + "Selection is not a valid statement or statements": { + "category": "Message", + "code": 95155 + }, + "Add 'override' modifier": { + "category": "Message", + "code": 95156 + }, + "Remove 'override' modifier": { + "category": "Message", + "code": 95157 + }, + "Add all 'override' modifier": { + "category": "Message", + "code": 95158 + }, + "Remove all 'override' modifier": { + "category": "Message", + "code": 95159 + }, + "Convert to property declaration and add 'override' modifier": { + "category": "Message", + "code": 95160 + }, + "Convert all to property declaration and add 'override' modifier": { + "category": "Message", + "code": 95161 + }, + + "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { + "category": "Error", + "code": 18004 + }, + "Classes may not have a field named 'constructor'.": { + "category": "Error", + "code": 18006 + }, + "JSX expressions may not use the comma operator. Did you mean to write an array?": { + "category": "Error", + "code": 18007 + }, + "Private identifiers cannot be used as parameters.": { + "category": "Error", + "code": 18009 + }, + "An accessibility modifier cannot be used with a private identifier.": { + "category": "Error", + "code": 18010 + }, + "The operand of a 'delete' operator cannot be a private identifier.": { + "category": "Error", + "code": 18011 + }, + "'#constructor' is a reserved word.": { + "category": "Error", + "code": 18012 + }, + "Property '{0}' is not accessible outside class '{1}' because it has a private identifier.": { + "category": "Error", + "code": 18013 + }, + "The property '{0}' cannot be accessed on type '{1}' within this class because it is shadowed by another private identifier with the same spelling.": { + "category": "Error", + "code": 18014 + }, + "Property '{0}' in type '{1}' refers to a different member that cannot be accessed from within type '{2}'.": { + "category": "Error", + "code": 18015 + }, + "Private identifiers are not allowed outside class bodies.": { + "category": "Error", + "code": 18016 + }, + "The shadowing declaration of '{0}' is defined here": { + "category": "Error", + "code": 18017 + }, + "The declaration of '{0}' that you probably intended to use is defined here": { + "category": "Error", + "code": 18018 + }, + "'{0}' modifier cannot be used with a private identifier.": { + "category": "Error", + "code": 18019 + }, + "A method cannot be named with a private identifier.": { + "category": "Error", + "code": 18022 + }, + "An accessor cannot be named with a private identifier.": { + "category": "Error", + "code": 18023 + }, + "An enum member cannot be named with a private identifier.": { + "category": "Error", + "code": 18024 + }, + "'#!' can only be used at the start of a file.": { + "category": "Error", + "code": 18026 + }, + "Compiler reserves name '{0}' when emitting private identifier downlevel.": { + "category": "Error", + "code": 18027 + }, + "Private identifiers are only available when targeting ECMAScript 2015 and higher.": { + "category": "Error", + "code": 18028 + }, + "Private identifiers are not allowed in variable declarations.": { + "category": "Error", + "code": 18029 + }, + "An optional chain cannot contain private identifiers.": { + "category": "Error", + "code": 18030 + }, + "The intersection '{0}' was reduced to 'never' because property '{1}' has conflicting types in some constituents.": { + "category": "Error", + "code": 18031 + }, + "The intersection '{0}' was reduced to 'never' because property '{1}' exists in multiple constituents and is private in some.": { + "category": "Error", + "code": 18032 + }, + "Only numeric enums can have computed members, but this expression has type '{0}'. If you do not need exhaustiveness checks, consider using an object literal instead.": { + "category": "Error", + "code": 18033 + }, + "Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'.": { + "category": "Message", + "code": 18034 + }, + "Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name.": { + "category": "Error", + "code": 18035 + } +} From eea8259b3cd64d6dae3fb55bdc5d0b7bb55ab121 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 7 Jan 2021 17:36:04 +0800 Subject: [PATCH 55/61] Revert merge conflict changes --- src/compiler/diagnosticMessages.json | 32 ++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 05ac1a0d66338..2afcd5f86a5ca 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -843,10 +843,6 @@ "category": "Error", "code": 1255 }, - "A rest element must be last in a tuple type.": { - "category": "Error", - "code": 1256 - }, "A required element cannot follow an optional element.": { "category": "Error", "code": 1257 @@ -875,6 +871,14 @@ "category": "Error", "code": 1264 }, + "A rest element cannot follow another rest element.": { + "category": "Error", + "code": 1265 + }, + "An optional element cannot follow a rest element.": { + "category": "Error", + "code": 1266 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", @@ -2621,9 +2625,25 @@ "category": "Error", "code": 2621 }, - "Element at index {0} is variadic in one type but not in the other.": { + "Source provides no match for required element at position {0} in target.": { + "category": "Error", + "code": 2623 + }, + "Source provides no match for variadic element at position {0} in target.": { + "category": "Error", + "code": 2624 + }, + "Variadic element at position {0} in source does not match element at position {1} in target.": { + "category": "Error", + "code": 2625 + }, + "Type at position {0} in source is not compatible with type at position {1} in target.": { + "category": "Error", + "code": 2626 + }, + "Type at positions {0} through {1} in source is not compatible with type at position {2} in target.": { "category": "Error", - "code": 2622 + "code": 2627 }, "Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": { From ff3cbc13f0010ba817e216978f45969e781be14c Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 7 Jan 2021 17:36:35 +0800 Subject: [PATCH 56/61] Accept baseline --- tests/baselines/reference/override1.js | 2 ++ tests/baselines/reference/override10.js | 2 ++ tests/baselines/reference/override2.js | 2 ++ tests/baselines/reference/override3.js | 2 ++ tests/baselines/reference/override4.js | 2 ++ tests/baselines/reference/override5.js | 2 ++ tests/baselines/reference/override6.js | 2 ++ tests/baselines/reference/override7.js | 2 ++ tests/baselines/reference/override8.js | 2 ++ tests/baselines/reference/overrideWithoutNoImplicitOverride1.js | 2 ++ 10 files changed, 20 insertions(+) diff --git a/tests/baselines/reference/override1.js b/tests/baselines/reference/override1.js index cf51e4cd0c8fa..af5357ffeac51 100644 --- a/tests/baselines/reference/override1.js +++ b/tests/baselines/reference/override1.js @@ -53,6 +53,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/override10.js b/tests/baselines/reference/override10.js index add4eb3e8e43f..61de880a2ffad 100644 --- a/tests/baselines/reference/override10.js +++ b/tests/baselines/reference/override10.js @@ -19,6 +19,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/override2.js b/tests/baselines/reference/override2.js index e7888b4efeebb..2f8d6ce799887 100644 --- a/tests/baselines/reference/override2.js +++ b/tests/baselines/reference/override2.js @@ -35,6 +35,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/override3.js b/tests/baselines/reference/override3.js index 48c56009dd7fb..dc7f818c87f64 100644 --- a/tests/baselines/reference/override3.js +++ b/tests/baselines/reference/override3.js @@ -34,6 +34,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/override4.js b/tests/baselines/reference/override4.js index 77017a90f29e0..6fbb9eac2ec0b 100644 --- a/tests/baselines/reference/override4.js +++ b/tests/baselines/reference/override4.js @@ -33,6 +33,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/override5.js b/tests/baselines/reference/override5.js index 2f20e1e70fed8..3ab9d96d52f6b 100644 --- a/tests/baselines/reference/override5.js +++ b/tests/baselines/reference/override5.js @@ -65,6 +65,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/override6.js b/tests/baselines/reference/override6.js index 05471cdbc22f6..f27cf2a32f25f 100644 --- a/tests/baselines/reference/override6.js +++ b/tests/baselines/reference/override6.js @@ -23,6 +23,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/override7.js b/tests/baselines/reference/override7.js index 3d22fd630e95f..36108f2359ed8 100644 --- a/tests/baselines/reference/override7.js +++ b/tests/baselines/reference/override7.js @@ -62,6 +62,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/override8.js b/tests/baselines/reference/override8.js index c3ed7da4f79cb..fb92faec3b806 100644 --- a/tests/baselines/reference/override8.js +++ b/tests/baselines/reference/override8.js @@ -39,6 +39,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/tests/baselines/reference/overrideWithoutNoImplicitOverride1.js b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.js index ec2a880e30e6c..e32cb4fb4897a 100644 --- a/tests/baselines/reference/overrideWithoutNoImplicitOverride1.js +++ b/tests/baselines/reference/overrideWithoutNoImplicitOverride1.js @@ -56,6 +56,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); From a3766d23c6581017935ca3dbaac4b6c0b3fd8035 Mon Sep 17 00:00:00 2001 From: kingwl Date: Thu, 7 Jan 2021 17:38:08 +0800 Subject: [PATCH 57/61] Avoid space --- src/compiler/diagnosticMessages.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 2afcd5f86a5ca..0d5d5c58c825b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -6175,7 +6175,6 @@ "category": "Message", "code": 95144 }, - "Use element access for '{0}'": { "category": "Message", "code": 95145 @@ -6192,7 +6191,6 @@ "category": "Message", "code": 95148 }, - "Return type must be inferred from a function": { "category": "Message", "code": 95149 From 1db64fb5ecd19ca1b5a48d6ec80b594efa468786 Mon Sep 17 00:00:00 2001 From: kingwl Date: Fri, 5 Mar 2021 15:06:09 +0800 Subject: [PATCH 58/61] Fix CR issues --- src/compiler/checker.ts | 42 +++++---- src/compiler/commandLineParser.ts | 2 +- src/compiler/diagnosticMessages.json | 26 ++---- src/services/codefixes/fixOverrideModifier.ts | 36 ++------ .../parameterPropertyToDeclaration.ts | 90 ------------------- src/services/tsconfig.json | 1 - .../baselines/reference/override2.errors.txt | 17 ++-- .../baselines/reference/override5.errors.txt | 5 +- .../fourslash/codeFixOverrideModifier10.ts | 18 +--- .../fourslash/codeFixOverrideModifier11.ts | 6 +- .../fourslash/codeFixOverrideModifier12.ts | 16 ++++ .../fourslash/codeFixOverrideModifier9.ts | 16 +--- .../codeFixOverrideModifier_fixAll1.ts | 2 +- .../codeFixOverrideModifier_fixAll2.ts | 2 +- .../codeFixOverrideModifier_fixAll3.ts | 64 ------------- 15 files changed, 70 insertions(+), 273 deletions(-) delete mode 100644 src/services/codefixes/parameterPropertyToDeclaration.ts create mode 100644 tests/cases/fourslash/codeFixOverrideModifier12.ts delete mode 100644 tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8e1dad023c444..99a13309ad230 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -36493,24 +36493,30 @@ namespace ts { const hasOverride = hasOverrideModifier(member); if (baseWithThis && (hasOverride || compilerOptions.noImplicitOverride)) { const declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); - if (declaredProp) { - const baseClassName = typeToString(baseWithThis); - const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); - const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); - if (prop && !baseProp && hasOverride) { - error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); - } - else if (prop && baseProp && compilerOptions.noImplicitOverride && !nodeInAmbientContext) { - const baseHasAbstract = hasAbstractModifier(baseProp.valueDeclaration); - if (!hasOverride && !baseHasAbstract) { - const diag = memberIsParameterProperty ? - Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0 : - Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; - error(member, diag, baseClassName); - } - else if (hasOverride && !hasAbstractModifier(member) && baseHasAbstract) { - error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0, baseClassName); - } + if (!declaredProp) { + return; + } + + const baseClassName = typeToString(baseWithThis); + const prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); + const baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); + if (prop && !baseProp && hasOverride) { + error(member, Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName); + } + else if (prop && baseProp?.valueDeclaration && compilerOptions.noImplicitOverride && !nodeInAmbientContext) { + const baseHasAbstract = hasAbstractModifier(baseProp.valueDeclaration); + if (hasOverride) { + return; + } + + if (!baseHasAbstract) { + const diag = memberIsParameterProperty ? + Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0 : + Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0; + error(member, diag, baseClassName); + } + else if (hasAbstractModifier(member) && baseHasAbstract) { + error(member, Diagnostics.This_member_must_have_an_override_modifier_because_it_is_override_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName); } } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index be2534fb8a714..aee24db8016ad 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -676,7 +676,7 @@ namespace ts { affectsSemanticDiagnostics: true, showInSimplifiedHelpView: false, category: Diagnostics.Additional_Checks, - description: Diagnostics.Force_overriding_members_in_derived_classes_to_be_marked_with_an_override_modifier + description: Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier }, { name: "noPropertyAccessFromIndexSignature", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f47e0e0acdd6e..e4e4dad8b2b42 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3657,7 +3657,7 @@ "category": "Error", "code": 4115 }, - "This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class '{0}'.": { + "This member must have an 'override' modifier because it is override an abstract method that is declared in the base class '{0}'.": { "category": "Error", "code": 4116 }, @@ -4994,22 +4994,18 @@ "category": "Message", "code": 6505 }, - "Require undeclared properties from index signatures to use element accesses.": { - "category": "Error", - "code": 6803 - }, "Include 'undefined' in index signature results": { "category": "Message", "code": 6800 }, - "Force overriding members in derived classes to be marked with an 'override' modifier.": { - "category": "Error", + "Ensure overriding members in derived classes are marked with an 'override' modifier.": { + "category": "Message", "code": 6801 }, "Require undeclared properties from index signatures to use element accesses.": { - "category": "Error", - "code": 6803 + "category": "Message", + "code": 6802 }, "Variable '{0}' implicitly has an '{1}' type.": { @@ -6293,22 +6289,14 @@ "category": "Message", "code": 95161 }, - "Add all 'override' modifier": { + "Add all missing 'override' modifiers": { "category": "Message", "code": 95162 }, - "Remove all 'override' modifier": { + "Remove all unnecessary 'override' modifiers": { "category": "Message", "code": 95163 }, - "Convert to property declaration and add 'override' modifier": { - "category": "Message", - "code": 95164 - }, - "Convert all to property declaration and add 'override' modifier": { - "category": "Message", - "code": 95165 - }, "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": { "category": "Error", diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index 498be1466e4af..c96abef09c407 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -3,7 +3,6 @@ namespace ts.codefix { const fixName = "fixOverrideModifier"; const fixAddOverrideId = "fixAddOverrideModifier"; const fixRemoveOverrideId = "fixRemoveOverrideModifier"; - const fixConvertToPropertyDeclarationId = "fixConvertToPropertyDeclaration"; type ClassElementHasJSDoc = | ConstructorDeclaration @@ -15,28 +14,22 @@ namespace ts.codefix { const errorCodes = [ Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code, Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, - Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0.code, - Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code, - Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code + Diagnostics.This_member_must_have_an_override_modifier_because_it_is_override_an_abstract_method_that_is_declared_in_the_base_class_0.code, + Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code ]; const errorCodeFixIdMap: Record = { [Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code]: [ - Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Add_all_override_modifier, + Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Add_all_missing_override_modifiers, ], [Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code]: [ - Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier + Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_unnecessary_override_modifiers ], - [Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0.code]: [ - Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier + [Diagnostics.This_member_must_have_an_override_modifier_because_it_is_override_an_abstract_method_that_is_declared_in_the_base_class_0.code]: [ + Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Remove_all_unnecessary_override_modifiers ], [Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]: [ - Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_override_modifier - ], - [Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code]: [ - Diagnostics.Convert_to_property_declaration_and_add_override_modifier, - fixConvertToPropertyDeclarationId, - Diagnostics.Convert_all_to_property_declaration_and_add_override_modifier + Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_unnecessary_override_modifiers ] }; @@ -56,7 +49,7 @@ namespace ts.codefix { createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId, fixAllDescriptions) ]; }, - fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId, fixConvertToPropertyDeclarationId], + fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { const { code, start, file } = diag; @@ -76,13 +69,11 @@ namespace ts.codefix { pos: number) { switch (errorCode) { case Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code: + case Diagnostics.This_member_must_have_an_override_modifier_because_it_is_override_an_abstract_method_that_is_declared_in_the_base_class_0.code: return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos); case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code: case Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code: - case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_implemented_an_abstract_method_that_declared_in_the_base_class_0.code: return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos); - case Diagnostics.This_parameter_property_must_be_rewritten_as_a_property_declaration_with_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code: - return doConvertToPropertyDeclaration(changeTracker, context.sourceFile, pos); default: Debug.fail("Unexpected error code: " + errorCode); } @@ -101,15 +92,6 @@ namespace ts.codefix { changeTracker.deleteModifier(sourceFile, overrideModifier); } - function doConvertToPropertyDeclaration(changeTracker: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number) { - const info = getConvertParameterPropertyToPropertyInfo(sourceFile, pos); - if (!info) { - return; - } - - getConvertParameterPropertyToPropertyChanges(changeTracker, sourceFile, info, ModifierFlags.Override); - } - function isClassElementHasJSDoc(node: Node): node is ClassElementHasJSDoc { switch (node.kind) { case SyntaxKind.Constructor: diff --git a/src/services/codefixes/parameterPropertyToDeclaration.ts b/src/services/codefixes/parameterPropertyToDeclaration.ts deleted file mode 100644 index a1aa4ef6a919b..0000000000000 --- a/src/services/codefixes/parameterPropertyToDeclaration.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* @internal */ -namespace ts.codefix { - interface ParameterPropertyToPropertyInfo { - parameter: ParameterPropertyDeclaration - ctor: ConstructorDeclaration - container: ClassLikeDeclaration - } - export function rangeContainsSkipTrivia(r1: TextRange, node: Node, file: SourceFile): boolean { - return rangeContainsStartEnd(r1, skipTrivia(file.text, node.pos), node.end); - } - - export function getConvertParameterPropertyToPropertyInfo(file: SourceFile, start: number, end?: number) { - const current = getTokenAtPosition(file, start); - const range = end && createTextRangeFromSpan(createTextSpan(start, end)); - - let maybeVariableName: Identifier | undefined; - let parameter = findAncestor(current, node => { - if (range && !rangeContainsSkipTrivia(range, node, file) || isFunctionLikeDeclaration(node)) { - return "quit"; - } - - if (isIdentifier(node)) { - maybeVariableName = node; - return false; - } - - if (isVariableLike(node)) { - if (isParameterDeclaration(node) && isParameterPropertyDeclaration(node, node.parent)) { - return true; - } - return "quit"; - } - - return false; - }); - - if (!parameter && maybeVariableName && isParameter(maybeVariableName.parent) && isParameterPropertyDeclaration(maybeVariableName.parent, maybeVariableName.parent.parent)) { - parameter = maybeVariableName.parent; - } - - if (!parameter) { - return undefined; - } - - Debug.assert(isParameterPropertyDeclaration(parameter, parameter.parent)); - - const ctor = parameter.parent; - const container = ctor.parent; - - return { - parameter, - ctor, - container - }; - } - - export function getConvertParameterPropertyToPropertyChanges(changeTracker: textChanges.ChangeTracker, file: SourceFile, info: ParameterPropertyToPropertyInfo, extraModifierFlags: ModifierFlags = ModifierFlags.None) { - const { parameter, ctor, container } = info; - - const newParameter = factory.createParameterDeclaration( - parameter.decorators, - /*modifiers*/ undefined, - parameter.dotDotDotToken, - parameter.name, - parameter.questionToken, - parameter.type, - parameter.initializer - ); - changeTracker.replaceNode(file, parameter, newParameter); - - const newPropertyDeclaration = factory.createPropertyDeclaration( - /*decorators*/ undefined, - createModifiers(modifiersToFlags(parameter.modifiers) | extraModifierFlags), - factory.createIdentifier(parameter.name.text), - factory.cloneNode(parameter.questionToken), - factory.cloneNode(parameter.type), - /*initializer*/ undefined - ); - changeTracker.insertNodeAtClassStart(file, container, newPropertyDeclaration); - - const assignment = factory.createAssignment( - factory.createPropertyAccessExpression( - factory.createThis(), - factory.createIdentifier(parameter.name.text) - ), - factory.createIdentifier(parameter.name.text) - ); - changeTracker.insertNodeAtConstructorStartAfterSuperCall(file, ctor, factory.createExpressionStatement(assignment)); - } -} \ No newline at end of file diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 12ed74b24f392..1e846b9214d16 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -96,7 +96,6 @@ "codefixes/disableJsDiagnostics.ts", "codefixes/helpers.ts", "codefixes/generateAccessors.ts", - "codefixes/parameterPropertyToDeclaration.ts", "codefixes/fixInvalidImportSyntax.ts", "codefixes/fixStrictClassInitialization.ts", "codefixes/requireInTs.ts", diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt index 62ef1bd93f889..a7e11b4d940ba 100644 --- a/tests/baselines/reference/override2.errors.txt +++ b/tests/baselines/reference/override2.errors.txt @@ -1,9 +1,8 @@ -tests/cases/conformance/override/override2.ts(17,14): error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. -tests/cases/conformance/override/override2.ts(23,14): error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. -tests/cases/conformance/override/override2.ts(24,14): error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(13,14): error TS4116: This member must have an 'override' modifier because it is override an abstract method that is declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(18,14): error TS4116: This member must have an 'override' modifier because it is override an abstract method that is declared in the base class 'AB'. -==== tests/cases/conformance/override/override2.ts (3 errors) ==== +==== tests/cases/conformance/override/override2.ts (2 errors) ==== abstract class AB { abstract foo(v: string): void; @@ -17,22 +16,20 @@ tests/cases/conformance/override/override2.ts(24,14): error TS4116: This member abstract class AD2 extends AB { abstract foo(v: ''): void // need override? + ~~~ +!!! error TS4116: This member must have an 'override' modifier because it is override an abstract method that is declared in the base class 'AB'. } abstract class AD3 extends AB { override foo(v: ''): void { } // need override? - ~~~ -!!! error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. abstract bar(): void; + ~~~ +!!! error TS4116: This member must have an 'override' modifier because it is override an abstract method that is declared in the base class 'AB'. baz(): void { } } class D4 extends AB { override foo(v: ''): void {} - ~~~ -!!! error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. override bar(v: ''): void {} - ~~~ -!!! error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AB'. baz(): void { } } \ No newline at end of file diff --git a/tests/baselines/reference/override5.errors.txt b/tests/baselines/reference/override5.errors.txt index 2f2c41d288580..18358a4928284 100644 --- a/tests/baselines/reference/override5.errors.txt +++ b/tests/baselines/reference/override5.errors.txt @@ -6,10 +6,9 @@ tests/cases/conformance/override/override5.ts(25,14): error TS1029: 'public' mod tests/cases/conformance/override/override5.ts(27,5): error TS1089: 'override' modifier cannot appear on a constructor declaration. tests/cases/conformance/override/override5.ts(44,23): error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. tests/cases/conformance/override/override5.ts(45,23): error TS4112: This member cannot have an 'override' modifier because its containing class 'AND' does not extend another class. -tests/cases/conformance/override/override5.ts(52,14): error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. -==== tests/cases/conformance/override/override5.ts (9 errors) ==== +==== tests/cases/conformance/override/override5.ts (8 errors) ==== class B { p1: number = 1; p2: number = 2; @@ -78,8 +77,6 @@ tests/cases/conformance/override/override5.ts(52,14): error TS4116: This member } override b(): void { - ~ -!!! error TS4116: This member cannot have an 'override' modifier because it is implemented an abstract method that declared in the base class 'AD'. } } diff --git a/tests/cases/fourslash/codeFixOverrideModifier10.ts b/tests/cases/fourslash/codeFixOverrideModifier10.ts index 108a5d2d8cb2b..fd70f63f08629 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier10.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier10.ts @@ -12,20 +12,4 @@ //// } //// } -verify.codeFix({ - description: "Convert to property declaration and add 'override' modifier", - index: 0, - newFileContent: -`class B { - b: string -} -class D extends B { - public readonly override b: string; - c = 10; - constructor(public a: string, b: string) { - super(); - this.b = b; - } -}`, -}) - +verify.not.codeFixAvailable(); diff --git a/tests/cases/fourslash/codeFixOverrideModifier11.ts b/tests/cases/fourslash/codeFixOverrideModifier11.ts index 9e09922042380..6620ab257e6b9 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier11.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier11.ts @@ -9,8 +9,4 @@ //// [|override bar() {}|] //// } -verify.codeFix({ - description: "Remove 'override' modifier", - newRangeContent: "bar() {}", - index: 0 -}) +verify.not.refactorAvailable(); diff --git a/tests/cases/fourslash/codeFixOverrideModifier12.ts b/tests/cases/fourslash/codeFixOverrideModifier12.ts new file mode 100644 index 0000000000000..60c673e739b0d --- /dev/null +++ b/tests/cases/fourslash/codeFixOverrideModifier12.ts @@ -0,0 +1,16 @@ +/// + +// @noImplicitOverride: true + +//// abstract class Base { +//// abstract bar(): void; +//// } +//// class Sub extends Base { +//// [|abstract bar() {}|] +//// } + +verify.codeFix({ + description: "Add 'override' modifier", + newRangeContent: "override abstract bar() {}", + index: 0 +}) diff --git a/tests/cases/fourslash/codeFixOverrideModifier9.ts b/tests/cases/fourslash/codeFixOverrideModifier9.ts index de26d7e6cd700..77e24bf09ca3c 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier9.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier9.ts @@ -11,19 +11,5 @@ //// } //// } -verify.codeFix({ - description: "Convert to property declaration and add 'override' modifier", - index: 0, - newFileContent: -`class B { - a: string -} -class D extends B { - public override a: string; - constructor(a: string, public b: string) { - super(); - this.a = a; - } -}`, -}) +verify.not.codeFixAvailable(); diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts index 1f21a7488acc9..1ec3130dc82dc 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier_fixAll1.ts @@ -37,7 +37,7 @@ verify.codeFixAll({ fixId: "fixAddOverrideModifier", - fixAllDescription: "Add all 'override' modifier", + fixAllDescription: "Add all missing 'override' modifiers", newFileContent: `class B { foo (v: string) {} fooo (v: string) {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts index a0912468b9410..7d391f73fec1b 100644 --- a/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts +++ b/tests/cases/fourslash/codeFixOverrideModifier_fixAll2.ts @@ -37,7 +37,7 @@ verify.codeFixAll({ fixId: "fixRemoveOverrideModifier", - fixAllDescription: "Remove all 'override' modifier", + fixAllDescription: "Remove all unnecessary 'override' modifiers", newFileContent: `class B { foo (v: string) {} fooo (v: string) {} diff --git a/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts b/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts deleted file mode 100644 index c8090d6ca358e..0000000000000 --- a/tests/cases/fourslash/codeFixOverrideModifier_fixAll3.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// - -// @noImplicitOverride: true -//// class B { -//// a: string -//// b: string -//// } -//// class D extends B { -//// constructor(public a: string, public readonly b: string) { -//// super(); -//// } -//// } -//// class BB { -//// constructor(public a: string) { -//// } -//// } -//// class DD extends BB { -//// constructor(public a: string) { -//// super(a) -//// } -//// } -//// class DDD extends BB { -//// public a: string; -//// constructor(a: string) { -//// super(a) -//// this.a = a -//// } -//// } - -verify.codeFixAll({ - fixId: "fixConvertToPropertyDeclaration", - fixAllDescription: "Convert all to property declaration and add 'override' modifier", - newFileContent: `class B { - a: string - b: string -} -class D extends B { - public override a: string; - public readonly override b: string; - constructor(a: string, b: string) { - super(); - this.a = a; - this.b = b; - } -} -class BB { - constructor(public a: string) { - } -} -class DD extends BB { - public override a: string; - constructor(a: string) { - super(a); - this.a = a; - } -} -class DDD extends BB { - public a: string; - constructor(a: string) { - super(a) - this.a = a - } -}` -}) From e3c09930cf7d30a8e591b3b3cde7dad35c1a7878 Mon Sep 17 00:00:00 2001 From: kingwl Date: Mon, 8 Mar 2021 15:41:15 +0800 Subject: [PATCH 59/61] Accept baseline --- .../tsConfig/Default initialized TSConfig/tsconfig.json | 2 +- .../Initialized TSConfig with advanced options/tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../Initialized TSConfig with files options/tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../declarationDir-is-specified.js | 2 +- .../when-outDir-and-declarationDir-is-specified.js | 2 +- .../when-outDir-is-specified.js | 2 +- .../with-outFile.js | 2 +- ...t-outDir-or-outFile-is-specified-with-declaration-enabled.js | 2 +- .../without-outDir-or-outFile-is-specified.js | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index 1415f0097cabe..435818af722d8 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index 42c49e07699c4..434feb2e7de3b 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index c934e210bea47..30082a05b3be2 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index c431d42671769..fb0e11be4e49f 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index a4c8b5b3a70f6..b10f0b2d527cd 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index aaa571539f59c..b9a41070da9ad 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 1415f0097cabe..435818af722d8 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 049244a0f4125..067a004c61225 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 3c1f9b98d2bdf..2a807fa32eeec 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -40,7 +40,7 @@ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js index 6b23041a4e540..de394a77ebf26 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js index 36ad33e5591e8..45954ca4a2757 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-and-declarationDir-is-specified.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js index 91af9cf82eff2..45d9b418f5e41 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/when-outDir-is-specified.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js index bda18f13afe05..6e9898f0d3e30 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/with-outFile.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js index 656355657a316..93db3ca3dd00f 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified-with-declaration-enabled.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js index 2e570b923ceaf..0ccfc70ae477c 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/without-outDir-or-outFile-is-specified.js @@ -61,7 +61,7 @@ interface Array { length: number; [n: number]: T; } // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Force overriding members in derived classes to be marked with an 'override' modifier. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ /* Module Resolution Options */ From 89517a04de7a9f25a5b029345f38f105baf9a9ca Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 9 Mar 2021 12:01:38 +0800 Subject: [PATCH 60/61] Fix typo and add more check --- src/compiler/checker.ts | 5 ++- src/compiler/diagnosticMessages.json | 2 +- src/services/codefixes/fixOverrideModifier.ts | 6 +-- .../baselines/reference/override11.errors.txt | 16 +++++++ tests/baselines/reference/override11.js | 43 +++++++++++++++++++ tests/baselines/reference/override11.symbols | 20 +++++++++ tests/baselines/reference/override11.types | 22 ++++++++++ .../baselines/reference/override2.errors.txt | 8 ++-- .../cases/conformance/override/override11.ts | 9 ++++ 9 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 tests/baselines/reference/override11.errors.txt create mode 100644 tests/baselines/reference/override11.js create mode 100644 tests/baselines/reference/override11.symbols create mode 100644 tests/baselines/reference/override11.types create mode 100644 tests/cases/conformance/override/override11.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5cae625ab6553..775c26c92e19f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -36521,7 +36521,7 @@ namespace ts { error(member, diag, baseClassName); } else if (hasAbstractModifier(member) && baseHasAbstract) { - error(member, Diagnostics.This_member_must_have_an_override_modifier_because_it_is_override_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName); + error(member, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName); } } } @@ -39919,6 +39919,9 @@ namespace ts { else if (flags & ModifierFlags.Static) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "override"); } + if (node.kind === SyntaxKind.Parameter) { + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } flags |= ModifierFlags.Override; lastOverride = modifier; break; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e4e4dad8b2b42..7faf8d0f8ca2a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3657,7 +3657,7 @@ "category": "Error", "code": 4115 }, - "This member must have an 'override' modifier because it is override an abstract method that is declared in the base class '{0}'.": { + "This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'.": { "category": "Error", "code": 4116 }, diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index c96abef09c407..7ebe1eeb9c936 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -14,7 +14,7 @@ namespace ts.codefix { const errorCodes = [ Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code, Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, - Diagnostics.This_member_must_have_an_override_modifier_because_it_is_override_an_abstract_method_that_is_declared_in_the_base_class_0.code, + Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code ]; @@ -25,7 +25,7 @@ namespace ts.codefix { [Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code]: [ Diagnostics.Remove_override_modifier, fixRemoveOverrideId, Diagnostics.Remove_all_unnecessary_override_modifiers ], - [Diagnostics.This_member_must_have_an_override_modifier_because_it_is_override_an_abstract_method_that_is_declared_in_the_base_class_0.code]: [ + [Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code]: [ Diagnostics.Add_override_modifier, fixAddOverrideId, Diagnostics.Remove_all_unnecessary_override_modifiers ], [Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code]: [ @@ -69,7 +69,7 @@ namespace ts.codefix { pos: number) { switch (errorCode) { case Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code: - case Diagnostics.This_member_must_have_an_override_modifier_because_it_is_override_an_abstract_method_that_is_declared_in_the_base_class_0.code: + case Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code: return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos); case Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code: case Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code: diff --git a/tests/baselines/reference/override11.errors.txt b/tests/baselines/reference/override11.errors.txt new file mode 100644 index 0000000000000..1dabb4e3806ce --- /dev/null +++ b/tests/baselines/reference/override11.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/override/override11.ts(6,18): error TS1090: 'static' modifier cannot appear on a parameter. + + +==== tests/cases/conformance/override/override11.ts (1 errors) ==== + class Base { + foo = 1; + } + + class Sub extends Base { + constructor (override public foo: number) { + ~~~~~~~~ +!!! error TS1090: 'static' modifier cannot appear on a parameter. + super(); + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/override11.js b/tests/baselines/reference/override11.js new file mode 100644 index 0000000000000..4bdc26c775942 --- /dev/null +++ b/tests/baselines/reference/override11.js @@ -0,0 +1,43 @@ +//// [override11.ts] +class Base { + foo = 1; +} + +class Sub extends Base { + constructor (override public foo: number) { + super(); + } +} + + +//// [override11.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var Base = /** @class */ (function () { + function Base() { + this.foo = 1; + } + return Base; +}()); +var Sub = /** @class */ (function (_super) { + __extends(Sub, _super); + function Sub(foo) { + var _this = _super.call(this) || this; + _this.foo = foo; + return _this; + } + return Sub; +}(Base)); diff --git a/tests/baselines/reference/override11.symbols b/tests/baselines/reference/override11.symbols new file mode 100644 index 0000000000000..3f66e4e87f516 --- /dev/null +++ b/tests/baselines/reference/override11.symbols @@ -0,0 +1,20 @@ +=== tests/cases/conformance/override/override11.ts === +class Base { +>Base : Symbol(Base, Decl(override11.ts, 0, 0)) + + foo = 1; +>foo : Symbol(Base.foo, Decl(override11.ts, 0, 12)) +} + +class Sub extends Base { +>Sub : Symbol(Sub, Decl(override11.ts, 2, 1)) +>Base : Symbol(Base, Decl(override11.ts, 0, 0)) + + constructor (override public foo: number) { +>foo : Symbol(Sub.foo, Decl(override11.ts, 5, 17)) + + super(); +>super : Symbol(Base, Decl(override11.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/override11.types b/tests/baselines/reference/override11.types new file mode 100644 index 0000000000000..679ab4b89fbfc --- /dev/null +++ b/tests/baselines/reference/override11.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/override/override11.ts === +class Base { +>Base : Base + + foo = 1; +>foo : number +>1 : 1 +} + +class Sub extends Base { +>Sub : Sub +>Base : Base + + constructor (override public foo: number) { +>foo : number + + super(); +>super() : void +>super : typeof Base + } +} + diff --git a/tests/baselines/reference/override2.errors.txt b/tests/baselines/reference/override2.errors.txt index a7e11b4d940ba..ed32ab6aae706 100644 --- a/tests/baselines/reference/override2.errors.txt +++ b/tests/baselines/reference/override2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/override/override2.ts(13,14): error TS4116: This member must have an 'override' modifier because it is override an abstract method that is declared in the base class 'AB'. -tests/cases/conformance/override/override2.ts(18,14): error TS4116: This member must have an 'override' modifier because it is override an abstract method that is declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(13,14): error TS4116: This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class 'AB'. +tests/cases/conformance/override/override2.ts(18,14): error TS4116: This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class 'AB'. ==== tests/cases/conformance/override/override2.ts (2 errors) ==== @@ -17,14 +17,14 @@ tests/cases/conformance/override/override2.ts(18,14): error TS4116: This member abstract class AD2 extends AB { abstract foo(v: ''): void // need override? ~~~ -!!! error TS4116: This member must have an 'override' modifier because it is override an abstract method that is declared in the base class 'AB'. +!!! error TS4116: This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class 'AB'. } abstract class AD3 extends AB { override foo(v: ''): void { } // need override? abstract bar(): void; ~~~ -!!! error TS4116: This member must have an 'override' modifier because it is override an abstract method that is declared in the base class 'AB'. +!!! error TS4116: This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class 'AB'. baz(): void { } } diff --git a/tests/cases/conformance/override/override11.ts b/tests/cases/conformance/override/override11.ts new file mode 100644 index 0000000000000..c7737a182cfbb --- /dev/null +++ b/tests/cases/conformance/override/override11.ts @@ -0,0 +1,9 @@ +class Base { + foo = 1; +} + +class Sub extends Base { + constructor (override public foo: number) { + super(); + } +} From 6c8d00d53463d57fbc751acc5810fd061d23dd97 Mon Sep 17 00:00:00 2001 From: kingwl Date: Tue, 9 Mar 2021 15:14:18 +0800 Subject: [PATCH 61/61] Fix error name --- src/compiler/checker.ts | 2 +- tests/baselines/reference/override11.errors.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 775c26c92e19f..e797b5b69a027 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -39920,7 +39920,7 @@ namespace ts { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "override"); } if (node.kind === SyntaxKind.Parameter) { - return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "override"); } flags |= ModifierFlags.Override; lastOverride = modifier; diff --git a/tests/baselines/reference/override11.errors.txt b/tests/baselines/reference/override11.errors.txt index 1dabb4e3806ce..0af9f32dd0a65 100644 --- a/tests/baselines/reference/override11.errors.txt +++ b/tests/baselines/reference/override11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/override/override11.ts(6,18): error TS1090: 'static' modifier cannot appear on a parameter. +tests/cases/conformance/override/override11.ts(6,18): error TS1090: 'override' modifier cannot appear on a parameter. ==== tests/cases/conformance/override/override11.ts (1 errors) ==== @@ -9,7 +9,7 @@ tests/cases/conformance/override/override11.ts(6,18): error TS1090: 'static' mod class Sub extends Base { constructor (override public foo: number) { ~~~~~~~~ -!!! error TS1090: 'static' modifier cannot appear on a parameter. +!!! error TS1090: 'override' modifier cannot appear on a parameter. super(); } }