Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix export = error message to not have redundant language #50308

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,7 @@ namespace ts {
if (exportAssignment) {
addRelatedInfo(err, createDiagnosticForNode(
exportAssignment,
Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag,
Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag,
compilerOptionName
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2677,7 +2677,7 @@
"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.": {
"This module is declared with 'export =', and can only be used with a default import when using the '{0}' flag.": {
"category": "Error",
"code": 2594
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ tests/cases/compiler/a.ts(1,8): error TS1259: Module '"tests/cases/compiler/b"'
import Foo from "./b";
~~~
!!! error TS1259: Module '"tests/cases/compiler/b"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
export var x = new Foo();

20 changes: 10 additions & 10 deletions tests/baselines/reference/es6ExportEqualsInterop.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,43 +77,43 @@ tests/cases/compiler/main.ts(106,15): error TS2498: Module '"class-module"' uses
import x1 from "interface";
~~
!!! error TS1259: Module '"interface"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x2 from "variable";
~~
!!! error TS1259: Module '"variable"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x3 from "interface-variable";
~~
!!! error TS1259: Module '"interface-variable"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x4 from "module";
~~
!!! error TS1259: Module '"module"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x5 from "interface-module";
~~
!!! error TS1259: Module '"interface-module"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x6 from "variable-module";
~~
!!! error TS1259: Module '"variable-module"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x7 from "function";
~~
!!! error TS1259: Module '"function"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x8 from "function-module";
~~
!!! error TS1259: Module '"function-module"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x9 from "class";
~~
!!! error TS1259: Module '"class"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
import x0 from "class-module";
~~
!!! error TS1259: Module '"class-module"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.

// namespace import
import * as y1 from "interface";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1259: Modul
import defaultBinding from "./es6ImportDefaultBindingInEs5_0";
~~~~~~~~~~~~~~
!!! error TS1259: Module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
import bar from './bar';
~~~
!!! error TS1259: Module '"/bar"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
!!! 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.
!!! 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.
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
import a from "./a";
~
!!! error TS1259: Module '"/a"' can only be default-imported using the 'esModuleInterop' flag
!!! 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.
!!! 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.

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

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

Expand Down