Skip to content

Commit 1a6e2da

Browse files
authored
docs: typescript tips for using Type-Only Imports and Export (vitejs#6260)
1 parent 6a47083 commit 1a6e2da

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/guide/features.md

+7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ Vite only performs transpilation on `.ts` files and does **NOT** perform type ch
3434

3535
Vite uses [esbuild](https://github.com/evanw/esbuild) to transpile TypeScript into JavaScript which is about 20~30x faster than vanilla `tsc`, and HMR updates can reflect in the browser in under 50ms.
3636

37+
Use the [Type-Only Imports and Export](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax to avoid potential problems like type-only imports being incorrectly bundled. for example:
38+
39+
```ts
40+
import type { T } from 'only/types'
41+
export type { T }
42+
```
43+
3744
### TypeScript Compiler Options
3845

3946
Some configuration fields under `compilerOptions` in `tsconfig.json` require special attention.

0 commit comments

Comments
 (0)