Skip to content

Commit 5392e26

Browse files
committed
Fix export = error message to not have redundant language
1 parent 9f7c0cb commit 5392e26

8 files changed

+17
-17
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,7 @@ namespace ts {
28192819
if (exportAssignment) {
28202820
addRelatedInfo(err, createDiagnosticForNode(
28212821
exportAssignment,
2822-
Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag,
2822+
Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag,
28232823
compilerOptionName
28242824
));
28252825
}

src/compiler/diagnosticMessages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2677,7 +2677,7 @@
26772677
"category": "Error",
26782678
"code": 2593
26792679
},
2680-
"This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag.": {
2680+
"This module is declared with 'export =', and can only be used with a default import when using the '{0}' flag.": {
26812681
"category": "Error",
26822682
"code": 2594
26832683
},

tests/baselines/reference/allowSyntheticDefaultImports6.errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ tests/cases/compiler/a.ts(1,8): error TS1259: Module '"tests/cases/compiler/b"'
1111
import Foo from "./b";
1212
~~~
1313
!!! error TS1259: Module '"tests/cases/compiler/b"' can only be default-imported using the 'esModuleInterop' flag
14-
!!! related TS2594 tests/cases/compiler/b.d.ts:4:1: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
14+
!!! related TS2594 tests/cases/compiler/b.d.ts:4:1: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
1515
export var x = new Foo();
1616

tests/baselines/reference/es6ExportEqualsInterop.errors.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -77,43 +77,43 @@ tests/cases/compiler/main.ts(106,15): error TS2498: Module '"class-module"' uses
7777
import x1 from "interface";
7878
~~
7979
!!! error TS1259: Module '"interface"' can only be default-imported using the 'esModuleInterop' flag
80-
!!! related TS2594 tests/cases/compiler/modules.d.ts:6:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
80+
!!! related TS2594 tests/cases/compiler/modules.d.ts:6:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
8181
import x2 from "variable";
8282
~~
8383
!!! error TS1259: Module '"variable"' can only be default-imported using the 'esModuleInterop' flag
84-
!!! related TS2594 tests/cases/compiler/modules.d.ts:14:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
84+
!!! related TS2594 tests/cases/compiler/modules.d.ts:14:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
8585
import x3 from "interface-variable";
8686
~~
8787
!!! error TS1259: Module '"interface-variable"' can only be default-imported using the 'esModuleInterop' flag
88-
!!! related TS2594 tests/cases/compiler/modules.d.ts:26:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
88+
!!! related TS2594 tests/cases/compiler/modules.d.ts:26:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
8989
import x4 from "module";
9090
~~
9191
!!! error TS1259: Module '"module"' can only be default-imported using the 'esModuleInterop' flag
92-
!!! related TS2594 tests/cases/compiler/modules.d.ts:34:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
92+
!!! related TS2594 tests/cases/compiler/modules.d.ts:34:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
9393
import x5 from "interface-module";
9494
~~
9595
!!! error TS1259: Module '"interface-module"' can only be default-imported using the 'esModuleInterop' flag
96-
!!! related TS2594 tests/cases/compiler/modules.d.ts:46:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
96+
!!! related TS2594 tests/cases/compiler/modules.d.ts:46:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
9797
import x6 from "variable-module";
9898
~~
9999
!!! error TS1259: Module '"variable-module"' can only be default-imported using the 'esModuleInterop' flag
100-
!!! related TS2594 tests/cases/compiler/modules.d.ts:60:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
100+
!!! related TS2594 tests/cases/compiler/modules.d.ts:60:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
101101
import x7 from "function";
102102
~~
103103
!!! error TS1259: Module '"function"' can only be default-imported using the 'esModuleInterop' flag
104-
!!! related TS2594 tests/cases/compiler/modules.d.ts:65:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
104+
!!! related TS2594 tests/cases/compiler/modules.d.ts:65:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
105105
import x8 from "function-module";
106106
~~
107107
!!! error TS1259: Module '"function-module"' can only be default-imported using the 'esModuleInterop' flag
108-
!!! related TS2594 tests/cases/compiler/modules.d.ts:74:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
108+
!!! related TS2594 tests/cases/compiler/modules.d.ts:74:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
109109
import x9 from "class";
110110
~~
111111
!!! error TS1259: Module '"class"' can only be default-imported using the 'esModuleInterop' flag
112-
!!! related TS2594 tests/cases/compiler/modules.d.ts:82:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
112+
!!! related TS2594 tests/cases/compiler/modules.d.ts:82:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
113113
import x0 from "class-module";
114114
~~
115115
!!! error TS1259: Module '"class-module"' can only be default-imported using the 'esModuleInterop' flag
116-
!!! related TS2594 tests/cases/compiler/modules.d.ts:94:5: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
116+
!!! related TS2594 tests/cases/compiler/modules.d.ts:94:5: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
117117

118118
// namespace import
119119
import * as y1 from "interface";

tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1259: Modul
99
import defaultBinding from "./es6ImportDefaultBindingInEs5_0";
1010
~~~~~~~~~~~~~~
1111
!!! error TS1259: Module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' can only be default-imported using the 'esModuleInterop' flag
12-
!!! related TS2594 tests/cases/compiler/es6ImportDefaultBindingInEs5_0.ts:2:1: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
12+
!!! related TS2594 tests/cases/compiler/es6ImportDefaultBindingInEs5_0.ts:2:1: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.

tests/baselines/reference/exportAssignmentWithoutAllowSyntheticDefaultImportsError.errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
import bar from './bar';
1313
~~~
1414
!!! error TS1259: Module '"/bar"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
15-
!!! related TS2594 /bar.ts:1:1: This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
15+
!!! related TS2594 /bar.ts:1:1: This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

tests/baselines/reference/javascriptImportDefaultBadExport.errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
import a from "./a";
1313
~
1414
!!! error TS1259: Module '"/a"' can only be default-imported using the 'esModuleInterop' flag
15-
!!! related TS2594 /a.js:5:1: This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
15+
!!! related TS2594 /a.js:5:1: This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
1616

tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Output::
3535
settings.json:1:1
3636
1 {"content":"Print this"}
3737
  ~
38-
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
38+
This module is declared with 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
3939

4040
[12:00:26 AM] Found 1 error. Watching for file changes.
4141

0 commit comments

Comments
 (0)