change error message
This commit is contained in:
parent
36d493eaa8
commit
e65cdc3953
6 changed files with 45 additions and 4 deletions
|
@ -17650,7 +17650,7 @@ namespace ts {
|
|||
|
||||
const container = node.parent.kind === SyntaxKind.SourceFile ? <SourceFile>node.parent : <ModuleDeclaration>node.parent.parent;
|
||||
if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) {
|
||||
error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
|
||||
error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
|
||||
return;
|
||||
}
|
||||
// Grammar checking
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
"category": "Error",
|
||||
"code": 1062
|
||||
},
|
||||
"An export assignment cannot be used in a namespace.": {
|
||||
"A default export can only be used in an ECMAScript-style module.": {
|
||||
"category": "Error",
|
||||
"code": 1063
|
||||
},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: An export assignment cannot be used in a namespace.
|
||||
tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: A default export can only be used in an ECMAScript-style module.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts (1 errors) ====
|
||||
module M {
|
||||
export = A;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1063: An export assignment cannot be used in a namespace.
|
||||
!!! error TS1063: A default export can only be used in an ECMAScript-style module.
|
||||
}
|
16
tests/baselines/reference/parserExportAssignment9.errors.txt
Normal file
16
tests/baselines/reference/parserExportAssignment9.errors.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1063: A default export can only be used in an ECMAScript-style module.
|
||||
tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1063: A default export can only be used in an ECMAScript-style module.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts (2 errors) ====
|
||||
namespace Foo {
|
||||
export default foo;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1063: A default export can only be used in an ECMAScript-style module.
|
||||
}
|
||||
|
||||
module Bar {
|
||||
export default bar;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1063: A default export can only be used in an ECMAScript-style module.
|
||||
}
|
18
tests/baselines/reference/parserExportAssignment9.js
Normal file
18
tests/baselines/reference/parserExportAssignment9.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
//// [parserExportAssignment9.ts]
|
||||
namespace Foo {
|
||||
export default foo;
|
||||
}
|
||||
|
||||
module Bar {
|
||||
export default bar;
|
||||
}
|
||||
|
||||
//// [parserExportAssignment9.js]
|
||||
var Foo;
|
||||
(function (Foo) {
|
||||
export default foo;
|
||||
})(Foo || (Foo = {}));
|
||||
var Bar;
|
||||
(function (Bar) {
|
||||
export default bar;
|
||||
})(Bar || (Bar = {}));
|
|
@ -0,0 +1,7 @@
|
|||
namespace Foo {
|
||||
export default foo;
|
||||
}
|
||||
|
||||
module Bar {
|
||||
export default bar;
|
||||
}
|
Loading…
Reference in a new issue