当你从dist文件夹中提取类时,有没有办法定义类的类型?
又说,有时候我会做...
import MyClass from "dist/classes/myClass.ts";
const instance = new MyClass();
您如何编写也适用于这种情况的.d.ts
文件,或者这可能吗?
你如何编写一个也适用于这种情况的 .d.ts 文件,或者这可能吗?
在tsconfig.json
中使用declaration:true
进行编译,并在 package.json 中使用types
。
更多
快速入门中介绍:https://basarat.gitbooks.io/typescript/content/docs/quick/nodejs.html