From 1a6e2da634a138fac908d70750734098a17b6a9f Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Sat, 25 Dec 2021 18:24:44 +0800 Subject: [PATCH] docs: typescript tips for using Type-Only Imports and Export (#6260) --- docs/guide/features.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/guide/features.md b/docs/guide/features.md index d46b3cdcc80f23..92dd4d9be8256a 100644 --- a/docs/guide/features.md +++ b/docs/guide/features.md @@ -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.