Updated error message for TS1031 (#40889)

Co-authored-by: Sai Geetha <sai.geetha@ssi.samsung.com>
This commit is contained in:
Sai Geetha Kandepalli Cherukuru
2020-10-01 16:37:14 -07:00
committed by GitHub
co-authored by Sai Geetha
parent da86332120
commit 0ba250dc3b
12 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -38687,7 +38687,7 @@ namespace ts {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
else if (isClassLike(node.parent)) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export");
}
else if (node.kind === SyntaxKind.Parameter) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
@@ -38710,7 +38710,7 @@ namespace ts {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare");
}
else if (node.kind === SyntaxKind.Parameter) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
+1 -1
View File
@@ -99,7 +99,7 @@
"category": "Error",
"code": 1030
},
"'{0}' modifier cannot appear on a class element.": {
"'{0}' modifier cannot appear on class elements of this kind.": {
"category": "Error",
"code": 1031
},
@@ -1,5 +1,5 @@
tests/cases/compiler/classExpressionPropertyModifiers.ts(2,36): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'export' modifier cannot appear on a class element.
tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'export' modifier cannot appear on class elements of this kind.
==== tests/cases/compiler/classExpressionPropertyModifiers.ts (2 errors) ====
@@ -9,6 +9,6 @@ tests/cases/compiler/classExpressionPropertyModifiers.ts(3,5): error TS1031: 'ex
!!! error TS1039: Initializers are not allowed in ambient contexts.
export foo = 1;
~~~~~~
!!! error TS1031: 'export' modifier cannot appear on a class element.
!!! error TS1031: 'export' modifier cannot appear on class elements of this kind.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(12,21): error TS1255: A definite assignment assertion '!' is not permitted in this context.
tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,5): error TS1031: 'declare' modifier cannot appear on a class element.
tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,5): error TS1031: 'declare' modifier cannot appear on class elements of this kind.
tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(15,17): error TS1183: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(17,24): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedPropertyDeclaration.ts(24,5): error TS2564: Property 'p' has no initializer and is not definitely assigned in the constructor.
@@ -25,7 +25,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/derivedUninitializedP
class BOther extends A {
declare m() { return 2 } // not allowed on methods
~~~~~~~
!!! error TS1031: 'declare' modifier cannot appear on a class element.
!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind.
~
!!! error TS1183: An implementation cannot be declared in ambient contexts.
declare nonce: any; // ok, even though it's not in the base
@@ -1,5 +1,5 @@
tests/cases/compiler/illegalModifiersOnClassElements.ts(2,19): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/compiler/illegalModifiersOnClassElements.ts(3,5): error TS1031: 'export' modifier cannot appear on a class element.
tests/cases/compiler/illegalModifiersOnClassElements.ts(3,5): error TS1031: 'export' modifier cannot appear on class elements of this kind.
==== tests/cases/compiler/illegalModifiersOnClassElements.ts (2 errors) ====
@@ -9,5 +9,5 @@ tests/cases/compiler/illegalModifiersOnClassElements.ts(3,5): error TS1031: 'exp
!!! error TS1039: Initializers are not allowed in ambient contexts.
export bar = 1;
~~~~~~
!!! error TS1031: 'export' modifier cannot appear on a class element.
!!! error TS1031: 'export' modifier cannot appear on class elements of this kind.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration3.ts(2,3): error TS1031: 'export' modifier cannot appear on a class element.
tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration3.ts(2,3): error TS1031: 'export' modifier cannot appear on class elements of this kind.
==== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration3.ts (1 errors) ====
class C {
export constructor() { }
~~~~~~
!!! error TS1031: 'export' modifier cannot appear on a class element.
!!! error TS1031: 'export' modifier cannot appear on class elements of this kind.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts(2,3): error TS1031: 'declare' modifier cannot appear on a class element.
tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts(2,3): error TS1031: 'declare' modifier cannot appear on class elements of this kind.
==== tests/cases/conformance/parser/ecmascript5/ConstructorDeclarations/parserConstructorDeclaration4.ts (1 errors) ====
class C {
declare constructor() { }
~~~~~~~
!!! error TS1031: 'declare' modifier cannot appear on a class element.
!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind.
}
@@ -1,4 +1,4 @@
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,5): error TS1031: 'export' modifier cannot appear on a class element.
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,5): error TS1031: 'export' modifier cannot appear on class elements of this kind.
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration10.ts(2,16): error TS2378: A 'get' accessor must return a value.
@@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb
class C {
export get Foo() { }
~~~~~~
!!! error TS1031: 'export' modifier cannot appear on a class element.
!!! error TS1031: 'export' modifier cannot appear on class elements of this kind.
~~~
!!! error TS2378: A 'get' accessor must return a value.
}
@@ -1,4 +1,4 @@
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration11.ts(2,5): error TS1031: 'declare' modifier cannot appear on a class element.
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration11.ts(2,5): error TS1031: 'declare' modifier cannot appear on class elements of this kind.
tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemberAccessorDeclaration11.ts(2,17): error TS2378: A 'get' accessor must return a value.
@@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/MemberAccessorDeclarations/parserMemb
class C {
declare get Foo() { }
~~~~~~~
!!! error TS1031: 'declare' modifier cannot appear on a class element.
!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind.
~~~
!!! error TS2378: A 'get' accessor must return a value.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration4.ts(2,5): error TS1031: 'export' modifier cannot appear on a class element.
tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration4.ts(2,5): error TS1031: 'export' modifier cannot appear on class elements of this kind.
==== tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration4.ts (1 errors) ====
class C {
export Foo() { }
~~~~~~
!!! error TS1031: 'export' modifier cannot appear on a class element.
!!! error TS1031: 'export' modifier cannot appear on class elements of this kind.
}
@@ -1,4 +1,4 @@
tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,5): error TS1031: 'declare' modifier cannot appear on a class element.
tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,5): error TS1031: 'declare' modifier cannot appear on class elements of this kind.
tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemberFunctionDeclaration5.ts(2,19): error TS1183: An implementation cannot be declared in ambient contexts.
@@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/MemberFunctionDeclarations/parserMemb
class C {
declare Foo() { }
~~~~~~~
!!! error TS1031: 'declare' modifier cannot appear on a class element.
!!! error TS1031: 'declare' modifier cannot appear on class elements of this kind.
~
!!! error TS1183: An implementation cannot be declared in ambient contexts.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration4.ts(2,3): error TS1031: 'export' modifier cannot appear on a class element.
tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration4.ts(2,3): error TS1031: 'export' modifier cannot appear on class elements of this kind.
==== tests/cases/conformance/parser/ecmascript5/MemberVariableDeclarations/parserMemberVariableDeclaration4.ts (1 errors) ====
class C {
export Foo;
~~~~~~
!!! error TS1031: 'export' modifier cannot appear on a class element.
!!! error TS1031: 'export' modifier cannot appear on class elements of this kind.
}