如何为用打字稿编写的内容编写打字稿定义文件?

How to write a typescript definition file for something written in typescript?

我正在考虑为 jsPDF-AutoTable 创建一个打字稿定义文件,请参阅 gitbug here. I started trying to write a typings file for this, but it didn't seem straight forward because it has been generated from typescript. The owner responded to me to say that he was having difficulties, because it has been generated from typescript. See issue

我本以为会有一种方法可以自动为使用打字稿构建的东西创建一个打字文件。这可能吗?

您可以在编译 TypeScript 文件时生成类型信息...

tsc --declaration app.ts

您也可以在 tsconfig.json 文件中进行设置 - 它将为您生成 .js.d.ts 文件。