这个问题很简单。
这是模块导出函数的方式。
exports = module.exports = debug.debug = debug;
这是 ES5 模块如何使用它的。
var debug = require('debug')('http')
现在在 Typescript 中有点不同。
import * as debug from 'debug';
这会返回一个我以前从未见过的奇怪对象,一个没有键值对的嵌套对象。
{ [Function: debug]
coerce: [Function: coerce],
disable: [Function: disable],
// More properties go here
}
如何调用该函数debug