Skip to content

Commit 6f5fdda

Browse files
authored
[moduleResolution bundler] List restrictions from initial PR in documentation (#2976)
1 parent c562844 commit 6f5fdda

File tree

3 files changed

+42
-39
lines changed

3 files changed

+42
-39
lines changed

packages/documentation/scripts/types/AllFilenames.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ export type AllDocsPages =
5252
| "modules-reference/Reference.md"
5353
| "modules-reference/Theory.md"
5454
| "modules-reference/appendices/ESM-CJS-Interop.md"
55+
| "modules-reference/diagrams/README"
5556
| "modules-reference/diagrams/declaration-files.svg"
5657
| "modules-reference/diagrams/esm-cjs-interop.md"
5758
| "modules-reference/diagrams/esm-cjs-interop.mmd-1.svg"
5859
| "modules-reference/diagrams/esm-cjs-interop.mmd-2.svg"
59-
| "modules-reference/diagrams/README"
6060
| "modules-reference/diagrams/theory.md"
6161
| "modules-reference/diagrams/theory.md-1.svg"
6262
| "modules-reference/diagrams/theory.md-2.svg"
@@ -124,8 +124,8 @@ export type AllDocsPages =
124124
| "release-notes/TypeScript 5.0.md"
125125
| "release-notes/TypeScript 5.1.md"
126126
| "release-notes/TypeScript 5.2.md"
127-
| "tutorials/Angular.md"
128127
| "tutorials/ASP.NET Core.md"
128+
| "tutorials/Angular.md"
129129
| "tutorials/Babel with TypeScript.md"
130130
| "tutorials/DOM Manipulation.md"
131131
| "tutorials/Gulp.md"

packages/ts-twoslasher/README.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,43 @@ Turns to:
583583
> }
584584
> ```
585585
586+
#### `import_files.ts`
587+
588+
```ts
589+
// @filename: file-with-export.ts
590+
export const helloWorld = "Example string"
591+
592+
// @filename: index.ts
593+
import { helloWorld } from "./file-with-export"
594+
console.log(helloWorld)
595+
```
596+
597+
Turns to:
598+
599+
> ```ts
600+
> // @filename: file-with-export.ts
601+
> export const helloWorld = "Example string"
602+
>
603+
> // @filename: index.ts
604+
> import { helloWorld } from "./file-with-export"
605+
> console.log(helloWorld)
606+
> ```
607+
608+
> With:
609+
610+
> ```json
611+
> {
612+
> "code": "See above",
613+
> "extension": "ts",
614+
> "highlights": [],
615+
> "queries": [],
616+
> "staticQuickInfos": "[ 5 items ]",
617+
> "errors": [],
618+
> "playgroundURL": "https://www.typescriptlang.org/play/#code/PTAEAEDMEsBsFMB2BDAtvAXKGCC0B3aAFwAtd4APABwHsAnIgOiIGcAoS2h0AYxsRZFQJeLFg0A6vVgATUAF5QAIgCiFNFQShBdaIgDmSgNxs2ICDiRpMoPTMrN20VFyEBvEWMnSZAX2x0NKjKjMCWBMRknPRESmx8AjQIjOL6ABSe4lJ0sgCUbEA",
619+
> "tags": []
620+
> }
621+
> ```
622+
586623
#### `importsModules.ts`
587624
588625
```ts
@@ -636,43 +673,6 @@ Turns to:
636673
> }
637674
> ```
638675
639-
#### `import_files.ts`
640-
641-
```ts
642-
// @filename: file-with-export.ts
643-
export const helloWorld = "Example string"
644-
645-
// @filename: index.ts
646-
import { helloWorld } from "./file-with-export"
647-
console.log(helloWorld)
648-
```
649-
650-
Turns to:
651-
652-
> ```ts
653-
> // @filename: file-with-export.ts
654-
> export const helloWorld = "Example string"
655-
>
656-
> // @filename: index.ts
657-
> import { helloWorld } from "./file-with-export"
658-
> console.log(helloWorld)
659-
> ```
660-
661-
> With:
662-
663-
> ```json
664-
> {
665-
> "code": "See above",
666-
> "extension": "ts",
667-
> "highlights": [],
668-
> "queries": [],
669-
> "staticQuickInfos": "[ 5 items ]",
670-
> "errors": [],
671-
> "playgroundURL": "https://www.typescriptlang.org/play/#code/PTAEAEDMEsBsFMB2BDAtvAXKGCC0B3aAFwAtd4APABwHsAnIgOiIGcAoS2h0AYxsRZFQJeLFg0A6vVgATUAF5QAIgCiFNFQShBdaIgDmSgNxs2ICDiRpMoPTMrN20VFyEBvEWMnSZAX2x0NKjKjMCWBMRknPRESmx8AjQIjOL6ABSe4lJ0sgCUbEA",
672-
> "tags": []
673-
> }
674-
> ```
675-
676676
#### `multiFileErrors.ts`
677677
678678
```ts

packages/tsconfig-reference/copy/en/options/moduleResolution.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Specify the module resolution strategy:
88
- `'node16'` or `'nodenext'` for modern versions of Node.js. Node.js v12 and later supports both ECMAScript imports and CommonJS `require`, which resolve using different algorithms. These `moduleResolution` values, when combined with the corresponding [`module`](#module) values, picks the right algorithm for each resolution based on whether Node.js will see an `import` or `require` in the output JavaScript code.
99
- `'node10'` (previously called `'node'`) for Node.js versions older than v10, which only support CommonJS `require`. You probably won't need to use `node10` in modern code.
1010
- `'bundler'` for use with bundlers. Like `node16` and `nodenext`, this mode supports package.json `"imports"` and `"exports"`, but unlike the Node.js resolution modes, `bundler` never requires file extensions on relative paths in imports.
11+
12+
`bundler` does not support resolution of `require` calls. In TypeScript files, this means the `import mod = require("foo")` syntax is forbidden; in JavaScript files, `require` calls are not errors but only ever return the type `any` (or whatever an ambient declaration of a global require function is declared to `return`).
13+
1114
- `'classic'` was used in TypeScript before the release of 1.6. `classic` should not be used.
1215

1316
There is a handbook reference page on [Module Resolution](/docs/handbook/module-resolution.html)

0 commit comments

Comments
 (0)