Skip to content

Commit

Permalink
docs: typescript tips for using Type-Only Imports and Export (vitejs#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ygj6 authored Dec 25, 2021
1 parent 6a47083 commit 1a6e2da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ Vite only performs transpilation on `.ts` files and does **NOT** perform type ch

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.

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:

```ts
import type { T } from 'only/types'
export type { T }
```

### TypeScript Compiler Options

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

0 comments on commit 1a6e2da

Please sign in to comment.