Skip to content

Commit f8188e4

Browse files
authored
Merge pull request #2478 from orta/fix_mod_res
Fix module resolution config option (+mention inline `type` on imports)
2 parents 7c8241b + ded3132 commit f8188e4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/documentation/copy/en/reference/Modules.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,12 @@ import { APIResponseType } from "./api";
141141

142142
// Explicitly use import type
143143
import type { APIResponseType } from "./api";
144+
145+
// Explicitly pull out a value (getResponse) and a type (APIResponseType)
146+
import { getResponse, type APIResponseType} from "./api";
144147
```
145148

146-
`import type` is always guaranteed to be removed from your JavaScript, and tools like Babel can make better assumptions about your code via the [`isolatedModules`](/tsconfig#isolatedModules) compiler flag.
149+
Any explicitly marked `type` import is guaranteed to be removed from your JavaScript, and tools like Babel can make better assumptions about your code via the [`isolatedModules`](/tsconfig#isolatedModules) compiler flag.
147150
You can read more in the [3.8 release notes](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-beta/#type-only-imports-exports).
148151

149152
## Default exports

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ oneline: "Specify how TypeScript looks up a file from a given module specifier."
66
Specify the module resolution strategy:
77

88
- `'node'` for Node.js' CommonJS implementation
9-
- `'node12'` or `'nodenext'` for Node.js' ECMAScript Module Support [from TypeScript 4.5 onwards](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/)
9+
- `'node16'` or `'nodenext'` for Node.js' ECMAScript Module Support [from TypeScript 4.7 onwards](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#esm-nodejs)
1010
- `'classic'` used in TypeScript before the release of 1.6. You probably won't need to use `classic` in modern code
1111

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

0 commit comments

Comments
 (0)