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