duo*_*dvk 7 typescript definitelytyped webpack umd
我正在进行图书馆调查
它使用gulp + webpack来构建umd包.
我想创建类型定义包(或者可能只是多个d.ts文件),以便在typescript项目中使用.我想有类似的东西:
import * as Survey from 'surveyjs';
Run Code Online (Sandbox Code Playgroud)
此处描述了Survey.*的所有争议:https: //github.com/dmitrykurmanov/surveyjs/blob/master/src/entries/ko.ts
我曾尝试使用:github.com/SitePen/dts-generator和github.com/TypeStrong/dts-bundle,但没有成功,有人可以告诉我正确的方向吗?
您可以通过在tsconfig.json中添加声明标志,让tsc为您的代码生成声明文件.
在你的情况下,它将是:
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"sourceMap": true,
"noImplicitAny": false,
"jsx": "react",
"declaration": true
},
// "filesGlob": [
// "typings/index.d.ts"
// ], // TODO
"include": [
"typings/index.d.ts",
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9475 次 |
| 最近记录: |