在具有标准package.json的服务器端 Node 项目中,我们应该如何混合coffescript和typescript文件?
npm install
、npm test
和 npm start
功能应该仍然可用。命令本身并不重要。
额外信息:
coffeescript 和 Typescript 需要能够尽可能多地相互通信
该项目编写于 Expres
最佳答案
How should we mix coffescript and typescript files?
只需添加 node.d.ts
,然后您应该能够从 typescript 中获取 var/require
coffescript 文件。要 require typescript 文件,请将它们编译为 JS(使用像atom 或 grunt/gulp 包这样的 IDE),然后你应该能够很好地需要它们。
要从 typescript 中使用 TypeScript,请使用 import/require
(而不是 var/require
),然后使用 --module commonjs
进行编译。
关于javascript - 如何在同一个 Nodejs 项目中混合 CoffeeScript 和 typescript 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31001322/