From 03a358922544b3ce44d13400830768cd63e113ce Mon Sep 17 00:00:00 2001 From: Mukesh Prasad Date: Tue, 1 Oct 2019 11:55:02 -0400 Subject: [PATCH] Better error message for mistaken import (#40) Issue number of the reported bug or feature request: microsoft#13601 --- src/compiler/checker.ts | 25 +++++++++++++++++-- src/compiler/diagnosticMessages.json | 8 ++++++ ...ImportDeclarationNameCollision4.errors.txt | 4 +-- ...BindingFollowedWithNamedImport1.errors.txt | 24 +++++++++--------- ...ngFollowedWithNamedImport1InEs5.errors.txt | 24 +++++++++--------- ...lowedWithNamedImport1WithExport.errors.txt | 24 +++++++++--------- ...dingFollowedWithNamedImportDts1.errors.txt | 24 +++++++++--------- 7 files changed, 81 insertions(+), 52 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 845c145fb6..6ece23f022 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2202,7 +2202,18 @@ namespace ts { )); } else { - error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); + if (moduleSymbol.exports && moduleSymbol.exports.has(node.symbol.escapedName)) { + error( + node.name, + Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead, + symbolToString(moduleSymbol), + symbolToString(node.symbol), + ); + } + else { + error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); + } + } } else if (hasSyntheticDefault) { @@ -2310,7 +2321,17 @@ namespace ts { } } else { - error(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); + if (moduleSymbol.exports && moduleSymbol.exports.has(InternalSymbolName.Default)) { + error( + name, + Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, + moduleName, + declarationName + ); + } + else { + error(name, Diagnostics.Module_0_has_no_exported_member_1, moduleName, declarationName); + } } } return symbol; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c5bde22eab..3414410abc 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1043,6 +1043,14 @@ "category": "Error", "code": 1358 }, + "Module '{0}' has no default export. Did you mean to use 'import { {1} } from {0}' instead?": { + "category": "Error", + "code": 1359 + }, + "Module '{0}' has no exported member '{1}'. Did you mean to use 'import {1} from {0}' instead?": { + "category": "Error", + "code": 1360 + }, "The types of '{0}' are incompatible between these types.": { "category": "Error", diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.errors.txt b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.errors.txt index 611a080481..38c3fb1931 100644 --- a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.errors.txt +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/service.ts(1,8): error TS1192: Module '"tests/cases/compiler/db"' has no default export. +tests/cases/compiler/service.ts(1,8): error TS1359: Module '"tests/cases/compiler/db"' has no default export. Did you mean to use 'import { db } from "tests/cases/compiler/db"' instead? ==== tests/cases/compiler/db.ts (0 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/service.ts(1,8): error TS1192: Module '"tests/cases/compile ==== tests/cases/compiler/service.ts (1 errors) ==== import db from './db'; // error no default export ~~ -!!! error TS1192: Module '"tests/cases/compiler/db"' has no default export. +!!! error TS1359: Module '"tests/cases/compiler/db"' has no default export. Did you mean to use 'import { db } from "tests/cases/compiler/db"' instead? function someDecorator(target) { return target; } diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1.errors.txt index 65eae425bc..fecddeb64b 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(3,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(5,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(7,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(7,30): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(9,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(11,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'm'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(3,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(5,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(7,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'. Did you mean to use 'import x from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(7,30): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(9,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'. Did you mean to use 'import x from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(11,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'm'. Did you mean to use 'import m from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_0.ts (0 errors) ==== @@ -15,24 +15,24 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1_1.ts(11,27) var x1: number = defaultBinding1; import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImport1_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? var x1: number = defaultBinding2; import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport1_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? var x1: number = defaultBinding3; import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport1_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'. Did you mean to use 'import x from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? var x1: number = defaultBinding4; import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport1_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'x'. Did you mean to use 'import x from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? var x1: number = defaultBinding5; import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport1_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'm'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1_0"' has no exported member 'm'. Did you mean to use 'import m from "./es6ImportDefaultBindingFollowedWithNamedImport1_0"' instead? var x1: number = defaultBinding6; \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.errors.txt index b8c06ab3c1..bb66a20eb3 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1InEs5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(3,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(5,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(7,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(7,30): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(9,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(11,27): error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'm'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(3,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(5,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(7,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. Did you mean to use 'import x from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(7,30): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(9,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. Did you mean to use 'import x from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(11,27): error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'm'. Did you mean to use 'import m from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0.ts (0 errors) ==== @@ -15,24 +15,24 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport1InEs5_1.ts(1 var x: number = defaultBinding1; import defaultBinding2, { a } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? var x: number = defaultBinding2; import defaultBinding3, { a as b } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? var x: number = defaultBinding3; import defaultBinding4, { x, a as y } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. Did you mean to use 'import x from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'a'. Did you mean to use 'import a from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? var x: number = defaultBinding4; import defaultBinding5, { x as z, } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'x'. Did you mean to use 'import x from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? var x: number = defaultBinding5; import defaultBinding6, { m, } from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"; ~ -!!! error TS2305: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'm'. +!!! error TS1360: Module '"./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' has no exported member 'm'. Did you mean to use 'import m from "./es6ImportDefaultBindingFollowedWithNamedImport1InEs5_0"' instead? var x: number = defaultBinding6; \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt index 6d0526d474..3a9f4f728f 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport1WithExport.errors.txt @@ -1,20 +1,20 @@ tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers. tests/cases/compiler/client.ts(2,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(3,1): error TS1191: An import declaration cannot have modifiers. -tests/cases/compiler/client.ts(3,34): error TS2305: Module '"./server"' has no exported member 'a'. +tests/cases/compiler/client.ts(3,34): error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? tests/cases/compiler/client.ts(4,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(5,1): error TS1191: An import declaration cannot have modifiers. -tests/cases/compiler/client.ts(5,34): error TS2305: Module '"./server"' has no exported member 'a'. +tests/cases/compiler/client.ts(5,34): error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? tests/cases/compiler/client.ts(6,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(7,1): error TS1191: An import declaration cannot have modifiers. -tests/cases/compiler/client.ts(7,34): error TS2305: Module '"./server"' has no exported member 'x'. -tests/cases/compiler/client.ts(7,37): error TS2305: Module '"./server"' has no exported member 'a'. +tests/cases/compiler/client.ts(7,34): error TS1360: Module '"./server"' has no exported member 'x'. Did you mean to use 'import x from "./server"' instead? +tests/cases/compiler/client.ts(7,37): error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? tests/cases/compiler/client.ts(8,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers. -tests/cases/compiler/client.ts(9,34): error TS2305: Module '"./server"' has no exported member 'x'. +tests/cases/compiler/client.ts(9,34): error TS1360: Module '"./server"' has no exported member 'x'. Did you mean to use 'import x from "./server"' instead? tests/cases/compiler/client.ts(10,12): error TS2323: Cannot redeclare exported variable 'x1'. tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers. -tests/cases/compiler/client.ts(11,34): error TS2305: Module '"./server"' has no exported member 'm'. +tests/cases/compiler/client.ts(11,34): error TS1360: Module '"./server"' has no exported member 'm'. Did you mean to use 'import m from "./server"' instead? tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported variable 'x1'. @@ -33,7 +33,7 @@ tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported v ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ -!!! error TS2305: Module '"./server"' has no exported member 'a'. +!!! error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? export var x1: number = defaultBinding2; ~~ !!! error TS2323: Cannot redeclare exported variable 'x1'. @@ -41,7 +41,7 @@ tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported v ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ -!!! error TS2305: Module '"./server"' has no exported member 'a'. +!!! error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? export var x1: number = defaultBinding3; ~~ !!! error TS2323: Cannot redeclare exported variable 'x1'. @@ -49,9 +49,9 @@ tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported v ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ -!!! error TS2305: Module '"./server"' has no exported member 'x'. +!!! error TS1360: Module '"./server"' has no exported member 'x'. Did you mean to use 'import x from "./server"' instead? ~ -!!! error TS2305: Module '"./server"' has no exported member 'a'. +!!! error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? export var x1: number = defaultBinding4; ~~ !!! error TS2323: Cannot redeclare exported variable 'x1'. @@ -59,7 +59,7 @@ tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported v ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ -!!! error TS2305: Module '"./server"' has no exported member 'x'. +!!! error TS1360: Module '"./server"' has no exported member 'x'. Did you mean to use 'import x from "./server"' instead? export var x1: number = defaultBinding5; ~~ !!! error TS2323: Cannot redeclare exported variable 'x1'. @@ -67,7 +67,7 @@ tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported v ~~~~~~ !!! error TS1191: An import declaration cannot have modifiers. ~ -!!! error TS2305: Module '"./server"' has no exported member 'm'. +!!! error TS1360: Module '"./server"' has no exported member 'm'. Did you mean to use 'import m from "./server"' instead? export var x1: number = defaultBinding6; ~~ !!! error TS2323: Cannot redeclare exported variable 'x1'. diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.errors.txt index b2313170af..8b582db4a2 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportDts1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/client.ts(3,27): error TS2305: Module '"./server"' has no exported member 'a'. -tests/cases/compiler/client.ts(5,27): error TS2305: Module '"./server"' has no exported member 'a'. -tests/cases/compiler/client.ts(7,27): error TS2305: Module '"./server"' has no exported member 'x'. -tests/cases/compiler/client.ts(7,30): error TS2305: Module '"./server"' has no exported member 'a'. -tests/cases/compiler/client.ts(9,27): error TS2305: Module '"./server"' has no exported member 'x'. -tests/cases/compiler/client.ts(11,27): error TS2305: Module '"./server"' has no exported member 'm'. +tests/cases/compiler/client.ts(3,27): error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? +tests/cases/compiler/client.ts(5,27): error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? +tests/cases/compiler/client.ts(7,27): error TS1360: Module '"./server"' has no exported member 'x'. Did you mean to use 'import x from "./server"' instead? +tests/cases/compiler/client.ts(7,30): error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? +tests/cases/compiler/client.ts(9,27): error TS1360: Module '"./server"' has no exported member 'x'. Did you mean to use 'import x from "./server"' instead? +tests/cases/compiler/client.ts(11,27): error TS1360: Module '"./server"' has no exported member 'm'. Did you mean to use 'import m from "./server"' instead? ==== tests/cases/compiler/server.ts (0 errors) ==== @@ -15,23 +15,23 @@ tests/cases/compiler/client.ts(11,27): error TS2305: Module '"./server"' has no export var x1 = new defaultBinding1(); import defaultBinding2, { a } from "./server"; ~ -!!! error TS2305: Module '"./server"' has no exported member 'a'. +!!! error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? export var x2 = new defaultBinding2(); import defaultBinding3, { a as b } from "./server"; ~ -!!! error TS2305: Module '"./server"' has no exported member 'a'. +!!! error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? export var x3 = new defaultBinding3(); import defaultBinding4, { x, a as y } from "./server"; ~ -!!! error TS2305: Module '"./server"' has no exported member 'x'. +!!! error TS1360: Module '"./server"' has no exported member 'x'. Did you mean to use 'import x from "./server"' instead? ~ -!!! error TS2305: Module '"./server"' has no exported member 'a'. +!!! error TS1360: Module '"./server"' has no exported member 'a'. Did you mean to use 'import a from "./server"' instead? export var x4 = new defaultBinding4(); import defaultBinding5, { x as z, } from "./server"; ~ -!!! error TS2305: Module '"./server"' has no exported member 'x'. +!!! error TS1360: Module '"./server"' has no exported member 'x'. Did you mean to use 'import x from "./server"' instead? export var x5 = new defaultBinding5(); import defaultBinding6, { m, } from "./server"; ~ -!!! error TS2305: Module '"./server"' has no exported member 'm'. +!!! error TS1360: Module '"./server"' has no exported member 'm'. Did you mean to use 'import m from "./server"' instead? export var x6 = new defaultBinding6(); \ No newline at end of file