dts-generator TypeScript声明文件打包工具

多个模块的 TypeScript 项目,用 dts-generator 打包声明文件挺省心的。你要是项目里有一堆 .ts 文件,想把它们导出去给别人用,但又不想搞一堆 .d.ts 分开管理,这工具就派上用场了。它会自动生成一个大而全的 .d.ts 包,每个模块都用 declare module 'xxx' 包起来,引用方便,还不容易出错。

背后用的是 TypeScript 的语言服务(1.4+),所以兼容性也还不错。用起来也不复杂,命令行一跑就能出结果,适合发库的时候带上。你再搭配 /// ,别人拿来用体验也挺顺滑的。

要是你之前用过 dts-bundle-generator,这俩工具思路差不多,但 dts-generator 更偏向按模块结构输出,适合模块分得比较细的项目。想对比下,可以看看这个教程

,如果你平时写 TypeScript 的库比较多,尤其是多文件模块的那种,dts-generator 真的可以让声明文件这摊事变得轻松不少。想省事、省心,不妨试试看。

zip
dts-generator-master.zip 预估大小:50个文件
folder
dts-generator-master 文件夹
file
.gitignore 43B
file
package.json 832B
file
tslint.json 2KB
folder
bin 文件夹
file
dts-generator 341B
file
dts-generator.ts 2KB
file
.travis.yml 120B
file
tsconfig.json 402B
file
README.md 5KB
folder
tests 文件夹
folder
unit 文件夹
file
all.ts 48B
folder
bin 文件夹
file
dts-generator.ts 546B
file
index.ts 9KB
folder
support 文件夹
folder
foo-resolve-tsx 文件夹
file
tsconfig.json 182B
file
index.ts 312B
file
baz.ts 326B
file
Bar.tsx 136B
folder
foo 文件夹
file
tsconfig.json 213B
file
index.ts 312B
file
tsconfig-alt.json 197B
file
Bar.ts 136B
file
baz.ts 326B
folder
foo-prefix 文件夹
file
tsconfig.json 243B
folder
sub 文件夹
file
somejs.d.ts 186B
file
index.ts 424B
file
Bar.ts 136B
file
baz.ts 326B
folder
foo-es6 文件夹
file
tsconfig.json 195B
file
index.ts 312B
file
Bar.ts 136B
file
baz.ts 326B
folder
foo-directories 文件夹
file
tsconfig.json 282B
folder
sub 文件夹
file
index.ts 316B
file
Bar.ts 136B
file
baz.ts 326B
folder
foo-resolve-module-id 文件夹
file
FooInterfaceExportDeclaration.ts 86B
file
FooInterfaceExportAssignment.ts 116B
file
FooImplExportAssignment.ts 260B
file
ExternalModuleDeclaration.d.ts 135B
file
tsconfig.json 411B
file
NonRelative.ts 96B
file
index.ts 678B
file
FooImplExportDeclaration.ts 235B
file
ReExport.ts 93B
file
tsconfig.json 190B
file
run.sh 407B
file
intern.json 35B
file
run.cmd 575B
file
index.ts 17KB
file
.npmignore 48B
folder
docs 文件夹
file
resolving-module-ids.md 4KB
folder
tasks 文件夹
file
dtsGenerator.js 685B
zip 文件大小:30.48KB