安装 @types/dva 得到如下提示
This is a stub types definition for dva (https://github.com/dvajs/dva). dva provides its own type definitions, so you don't need @types/dva installed!
但是dva中并没有类型定义文件。
请问一个如何在typescript中正确使用dva呢?我使用的打包工具是 parcel。
根据作者的更新——[email protected] beta test
我经过测试得到:2.2.0-beta.2 版本,依旧没有.d.ts的存在。望修复。
找到bug的原因了:
发布的主要方法见于 TypeScript: 发布
{
"name": "awesome",
"author": "Vandelay Industries",
"version": "1.0.0",
"main": "./lib/main.js",
"types": "./lib/main.d.ts"
}
由于作者在package.json没有填写main和types,所以,我们得不到.d.ts文件。
望修复。
望修复+1
+1
+1
看起来 dva 使用 index.d.ts 可以不需要显式声明:
Also note that if your main declaration file is named index.d.ts and lives at the root of the package (next to index.js) you do not need to mark the "types" property, though it is advisable to do so.
来自: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
It's fixed in the master.
Most helpful comment
找到bug的原因了:
发布的主要方法见于 TypeScript: 发布
由于作者在package.json没有填写
main和types,所以,我们得不到.d.ts文件。望修复。