vite-plugin-dts 0.9.4 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ A vite plugin that generate `.d.ts` files from `.ts` or `.vue` source files for
7
7
  ## Install
8
8
 
9
9
  ```sh
10
- yarn add vite-plugin-dts -D
10
+ pnpm add vite-plugin-dts -D
11
11
  ```
12
12
 
13
13
  ## Usage
@@ -154,7 +154,7 @@ export interface PluginOptions {
154
154
  Clone and run the following script:
155
155
 
156
156
  ```sh
157
- yarn run test:e2e
157
+ pnpm run test:e2e
158
158
  ```
159
159
 
160
160
  Then check `example/types`.
@@ -169,6 +169,12 @@ By default `skipDiagnostics` option is `true`, which means that type diagnostic
169
169
 
170
170
  If your project has not type diagnostic tools, you can set `skipDiagnostics: false` and `logDiagnostics: true` to turn on the diagnostic and log features of this plugin. It will help you to check the type errors during build and log error information to the terminal.
171
171
 
172
+ ### Take type error when using both `script` and `setup-script` in vue component
173
+
174
+ This is usually caused by using `defineComponent` function in both `script` and `setup-script`. When `vue/compiler-sfc` compiles these files, the default export result in `script` will be merged into the parameter object of `defineComponent` that in `setup-script`, but there is incompatible of `defineComponent` returned types and parameter types, then a type error is caused.
175
+
176
+ Here is a simple [example](https://github.com/qmhc/vite-plugin-dts/blob/main/example/components/BothScripts.vue), you should remove the `defineComponent` which in `script` and export a native object directly.
177
+
172
178
  ## License
173
179
 
174
180
  MIT License.
package/README.zh-CN.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ## 安装
8
8
 
9
9
  ```sh
10
- yarn add vite-plugin-dts -D
10
+ pnpm add vite-plugin-dts -D
11
11
  ```
12
12
 
13
13
  ## 使用
@@ -153,7 +153,7 @@ export interface PluginOptions {
153
153
  克隆项目然后执行下列命令:
154
154
 
155
155
  ```sh
156
- yarn run test:e2e
156
+ pnpm run test:e2e
157
157
  ```
158
158
 
159
159
  然后检查 `example/types` 目录。
@@ -168,6 +168,12 @@ yarn run test:e2e
168
168
 
169
169
  如果您的项目没有依赖外部的类型检查工具,这时候可以您可以设置 `skipDiagnostics: false` 和 `logDiagnostics: true` 来打开插件的诊断与输出功能,这将帮助您检查打包过程中出现的类型错误并将错误信息输出至终端。
170
170
 
171
+ ### Vue 组件中同时使用了 `script` 和 `setup-script` 后出现类型错误
172
+
173
+ 这通常是由于分别在 `script` 和 `setup-script` 中同时使用了 `defineComponent` 方法导致的。 `vue/compiler-sfc` 为这类文件编译时会将 `script` 中的默认导出结果合并到 `setup-script` 的 `defineComponent` 的参数定义中,而 `defineComponent` 的参数类型与结果类型并不兼容,这一行为将会导致类型错误。
174
+
175
+ 这是一个简单的[示例](https://github.com/qmhc/vite-plugin-dts/blob/main/example/components/BothScripts.vue),您应该将位于 `script` 中的 `defineComponent` 方法移除,直接导出一个原始的对象。
176
+
171
177
  ## 授权
172
178
 
173
179
  MIT 授权。