Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure export= symbol from JavaScript always has a valueDeclaration (#…
- Loading branch information
1 parent
e8782ae
commit 1d3ecc0
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/javascriptImportDefaultBadExport.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/b.js(1,8): error TS1259: Module '"/a"' can only be default-imported using the 'esModuleInterop' flag | ||
|
||
|
||
==== /a.js (0 errors) ==== | ||
// https://github.com/microsoft/TypeScript/issues/34481 | ||
|
||
|
||
const alias = {}; | ||
module.exports = alias; | ||
|
||
==== /b.js (1 errors) ==== | ||
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. | ||
|
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/javascriptImportDefaultBadExport.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
=== /a.js === | ||
// https://github.com/microsoft/TypeScript/issues/34481 | ||
|
||
|
||
const alias = {}; | ||
>alias : Symbol(alias, Decl(a.js, 3, 5)) | ||
|
||
module.exports = alias; | ||
>module.exports : Symbol("/a", Decl(a.js, 0, 0)) | ||
>module : Symbol(export=, Decl(a.js, 3, 17)) | ||
>exports : Symbol(export=, Decl(a.js, 3, 17)) | ||
>alias : Symbol(alias, Decl(a.js, 3, 5)) | ||
|
||
=== /b.js === | ||
import a from "./a"; | ||
>a : Symbol(a, Decl(b.js, 0, 6)) | ||
|
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/javascriptImportDefaultBadExport.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
=== /a.js === | ||
// https://github.com/microsoft/TypeScript/issues/34481 | ||
|
||
|
||
const alias = {}; | ||
>alias : {} | ||
>{} : {} | ||
|
||
module.exports = alias; | ||
>module.exports = alias : {} | ||
>module.exports : {} | ||
>module : { "/a": {}; } | ||
>exports : {} | ||
>alias : {} | ||
|
||
=== /b.js === | ||
import a from "./a"; | ||
>a : any | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// https://github.com/microsoft/TypeScript/issues/34481 | ||
|
||
// @allowJs: true | ||
// @checkJs: true | ||
// @noEmit: true | ||
|
||
// @Filename: /a.js | ||
const alias = {}; | ||
module.exports = alias; | ||
|
||
// @Filename: /b.js | ||
import a from "./a"; |