From e2f26811641a10944e8f2f90f3b33a1b45aeb222 Mon Sep 17 00:00:00 2001 From: Wei Date: Sat, 22 May 2021 22:16:31 +0800 Subject: [PATCH 1/2] feat(create-app): improve client types (#3214) --- guide/features.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/guide/features.md b/guide/features.md index f7d363f0..383735ba 100644 --- a/guide/features.md +++ b/guide/features.md @@ -38,7 +38,13 @@ Note that because `esbuild` only performs transpilation without type information ### Client Types -Vite's default types are for its Node.js API. To shim the environment of client side code in a Vite application, add `vite/client` to `compilerOptions.types` of your `tsconfig`: +Vite's default types are for its Node.js API. To shim the environment of client side code in a Vite application, add a `d.ts` declaration file: + +```typescript +/// +``` + +Also, you can add `vite/client` to `compilerOptions.types` of your `tsconfig`: ```json { From 3430d58910403a98dcf29c0c26fab0897845c7e0 Mon Sep 17 00:00:00 2001 From: KnowsCount <56480008+KnowsCount@users.noreply.github.com> Date: Sun, 23 May 2021 14:09:38 +0800 Subject: [PATCH 2/2] docs(guide/features): fix conflict --- guide/features.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/guide/features.md b/guide/features.md index 82bf96b9..09e9a40e 100644 --- a/guide/features.md +++ b/guide/features.md @@ -38,17 +38,13 @@ Vite 使用 [esbuild](https://github.com/evanw/esbuild) 将 TypeScript 转译到 ### 客户端类型 {#client-types} -<<<<<<< HEAD -Vite 默认的类型定义是写给它的 Node.js API 的。要将其补充到一个 Vite 应用的客户端代码环境中,请将 `vite/client` 添加到 `tsconfig` 中的 `compilerOptions.types` 下: -======= -Vite's default types are for its Node.js API. To shim the environment of client side code in a Vite application, add a `d.ts` declaration file: +Vite 默认的类型定义是写给它的 Node.js API 的。要将其补充到一个 Vite 应用的客户端代码环境中,请添加一个 `d.ts` 声明文件: ```typescript /// ``` -Also, you can add `vite/client` to `compilerOptions.types` of your `tsconfig`: ->>>>>>> e2f26811641a10944e8f2f90f3b33a1b45aeb222 +同时,你也可以将 `vite/client` 添加到 `tsconfig` 中的 `compilerOptions.types` 下: ```json {