如何在Typescript中声明NodeJs模块?
我的消费节点代码如下所示:
var helloworld = require('helloworld'); helloworld.sayhello();
使用Typescript善良,我将如何声明导出sayhello()
函数的模块?
helloworld.ts
export function sayhello() { console.log('hello, world!'); }
请注意,你不会写一个包含module
块(文件本身就是模块)。