我正在寻找在节点内使用打字稿,目前我习惯于通过纯粹使用内部模块的///<reference.../>
语法使用打字稿。但是,对于较大的项目,这会变得很笨重,因为您可以使用引用其他模块的模块来引用相关链接。包装许多内部模块输出打字稿
因此,对于这个节点的项目,我想尝试将所有逻辑组件内部模块/类很像之前,所以他们都将在内部相互引用,但通过这将暴露一个外部模块揭露他们底层类等
这样的语法将是非常相似的现有机制需要,如节点:
import database = require("my-external-db-module.ts");
var connection = new database.Connection(someUrl);
而非
///<reference path="my-internal-db-modules.ts" />
var connection = new Database.Connection(someUrl);
和我想象中的语法会是这样的:
///<reference path="all-my-internal-module-files-etc.ts" />
///<reference path="..." />
export module SomeExposingModule
{
// Not quite sure what to put in here to expose the internal modules
}
那么,有没有任何形式的身边这样的事情的最佳做法或谁做类似的东西,或者每个人都只是坚持使用任何其他内部模块复杂的东西?
就我而言,使用Unix构建脚本,我发现使用以下命令可以更轻松地实现相同的结果: echo'module.exports = Framework;' >> Framework.js –