Skip to content

Fix module resolution config option (+mention inline type on imports) #2478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/documentation/copy/en/reference/Modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ import { APIResponseType } from "./api";

// Explicitly use import type
import type { APIResponseType } from "./api";

// Explicitly pull out a value (getResponse) and a type (APIResponseType)
import { getResponse, type APIResponseType} from "./api";
```

`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.
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.
You can read more in the [3.8 release notes](https://devblogs.microsoft.com/typescript/announcing-typescript-3-8-beta/#type-only-imports-exports).

## Default exports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ oneline: "Specify how TypeScript looks up a file from a given module specifier."
Specify the module resolution strategy:

- `'node'` for Node.js' CommonJS implementation
- `'node12'` or `'nodenext'` for Node.js' ECMAScript Module Support [from TypeScript 4.5 onwards](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/)
- `'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)
- `'classic'` used in TypeScript before the release of 1.6. You probably won't need to use `classic` in modern code

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