From 5392e268912be229391dcb777ad1f084e2c01fb1 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 15 Aug 2022 12:23:17 -0700 Subject: [PATCH] Fix export = error message to not have redundant language --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- .../allowSyntheticDefaultImports6.errors.txt | 2 +- .../es6ExportEqualsInterop.errors.txt | 20 +++++++++---------- .../es6ImportDefaultBindingInEs5.errors.txt | 2 +- ...lowSyntheticDefaultImportsError.errors.txt | 2 +- ...avascriptImportDefaultBadExport.errors.txt | 2 +- ...n-works-when-returned-without-extension.js | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4bb04010c1926..aa9c02cf51ca6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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 )); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 45792ea5096bd..54b131fa32ae6 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -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 }, diff --git a/tests/baselines/reference/allowSyntheticDefaultImports6.errors.txt b/tests/baselines/reference/allowSyntheticDefaultImports6.errors.txt index 916f50162a121..fedd9b350ff9f 100644 --- a/tests/baselines/reference/allowSyntheticDefaultImports6.errors.txt +++ b/tests/baselines/reference/allowSyntheticDefaultImports6.errors.txt @@ -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(); \ No newline at end of file diff --git a/tests/baselines/reference/es6ExportEqualsInterop.errors.txt b/tests/baselines/reference/es6ExportEqualsInterop.errors.txt index d7b992f2c1607..b1e3ac15f6b3b 100644 --- a/tests/baselines/reference/es6ExportEqualsInterop.errors.txt +++ b/tests/baselines/reference/es6ExportEqualsInterop.errors.txt @@ -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"; diff --git a/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt index 924792bf98adf..3eb6dd0e8b6c2 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt @@ -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. \ No newline at end of file +!!! 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. \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignmentWithoutAllowSyntheticDefaultImportsError.errors.txt b/tests/baselines/reference/exportAssignmentWithoutAllowSyntheticDefaultImportsError.errors.txt index d59ec8b42c86f..ba44def77ef37 100644 --- a/tests/baselines/reference/exportAssignmentWithoutAllowSyntheticDefaultImportsError.errors.txt +++ b/tests/baselines/reference/exportAssignmentWithoutAllowSyntheticDefaultImportsError.errors.txt @@ -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. \ No newline at end of file +!!! 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. \ No newline at end of file diff --git a/tests/baselines/reference/javascriptImportDefaultBadExport.errors.txt b/tests/baselines/reference/javascriptImportDefaultBadExport.errors.txt index 71ff85e2155fe..e5631c22a89ed 100644 --- a/tests/baselines/reference/javascriptImportDefaultBadExport.errors.txt +++ b/tests/baselines/reference/javascriptImportDefaultBadExport.errors.txt @@ -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. \ No newline at end of file diff --git a/tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js b/tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js index 8cf3621e0c5f0..0e85dbe7067f7 100644 --- a/tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js +++ b/tests/baselines/reference/tscWatch/watchApi/verify-that-module-resolution-with-json-extension-works-when-returned-without-extension.js @@ -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.