-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Follow and respect export maps when generating module specifiers
- Loading branch information
Showing
40 changed files
with
1,695 additions
and
11 deletions.
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
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
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
36 changes: 36 additions & 0 deletions
36
...baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node12).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,36 @@ | ||
tests/cases/conformance/node/index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. | ||
tests/cases/conformance/node/index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. | ||
tests/cases/conformance/node/index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. | ||
|
||
|
||
==== tests/cases/conformance/node/index.ts (3 errors) ==== | ||
// esm format file | ||
import { Thing } from "inner/other"; | ||
~~~~~~~~~~~~~ | ||
!!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. | ||
export const a = (await import("inner")).x(); | ||
~ | ||
!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. | ||
~~~~~ | ||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. | ||
==== tests/cases/conformance/node/node_modules/inner/index.d.ts (0 errors) ==== | ||
// esm format file | ||
export { x } from "./other.js"; | ||
==== tests/cases/conformance/node/node_modules/inner/other.d.ts (0 errors) ==== | ||
// esm format file | ||
export interface Thing {} | ||
export const x: () => Thing; | ||
==== tests/cases/conformance/node/package.json (0 errors) ==== | ||
{ | ||
"name": "package", | ||
"private": true, | ||
"type": "module", | ||
"exports": "./index.js" | ||
} | ||
==== tests/cases/conformance/node/node_modules/inner/package.json (0 errors) ==== | ||
{ | ||
"name": "inner", | ||
"private": true, | ||
"type": "module", | ||
"exports": "./index.js" | ||
} |
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node12).js
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,30 @@ | ||
//// [tests/cases/conformance/node/nodeModulesExportsBlocksSpecifierResolution.ts] //// | ||
|
||
//// [index.ts] | ||
// esm format file | ||
import { Thing } from "inner/other"; | ||
export const a = (await import("inner")).x(); | ||
//// [index.d.ts] | ||
// esm format file | ||
export { x } from "./other.js"; | ||
//// [other.d.ts] | ||
// esm format file | ||
export interface Thing {} | ||
export const x: () => Thing; | ||
//// [package.json] | ||
{ | ||
"name": "package", | ||
"private": true, | ||
"type": "module", | ||
"exports": "./index.js" | ||
} | ||
//// [package.json] | ||
{ | ||
"name": "inner", | ||
"private": true, | ||
"type": "module", | ||
"exports": "./index.js" | ||
} | ||
|
||
//// [index.js] | ||
export const a = (await import("inner")).x(); |
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/nodeModulesExportsBlocksSpecifierResolution(module=node12).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,25 @@ | ||
=== tests/cases/conformance/node/index.ts === | ||
// esm format file | ||
import { Thing } from "inner/other"; | ||
>Thing : Symbol(Thing, Decl(index.ts, 1, 8)) | ||
|
||
export const a = (await import("inner")).x(); | ||
>a : Symbol(a, Decl(index.ts, 2, 12)) | ||
>(await import("inner")).x : Symbol(x, Decl(index.d.ts, 1, 8)) | ||
>"inner" : Symbol("tests/cases/conformance/node/node_modules/inner/index", Decl(index.d.ts, 0, 0)) | ||
>x : Symbol(x, Decl(index.d.ts, 1, 8)) | ||
|
||
=== tests/cases/conformance/node/node_modules/inner/index.d.ts === | ||
// esm format file | ||
export { x } from "./other.js"; | ||
>x : Symbol(x, Decl(index.d.ts, 1, 8)) | ||
|
||
=== tests/cases/conformance/node/node_modules/inner/other.d.ts === | ||
// esm format file | ||
export interface Thing {} | ||
>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) | ||
|
||
export const x: () => Thing; | ||
>x : Symbol(x, Decl(other.d.ts, 2, 12)) | ||
>Thing : Symbol(Thing, Decl(other.d.ts, 0, 0)) | ||
|
Oops, something went wrong.