我有三个文件:
//some-class.js
class SomeClass {}
module.exports = SomeClass
//helpers.js
const someFunc = () => {}
module.exports = {someFunc}
//index.js
const SomeClass = require("./src/some-class")
const helpers = require("./src/helpers")
module.exports = {SomeClass, helpers}
我需要为它们描述类型,所以我创建了index.d.ts:
declare module someModule {
class SomeClass {}
}
export = someModule
但是为helpers
声明类型时出现问题,哪种更好的方法呢?
答案 0 :(得分:0)
使用命名空间修复该问题:
{
orders: [
{
type: 'some data',
id: 'some data',
number: 'some data',
startAddress: 'some datasome data',
endAddress: 'some datasome data',
loadingDate: 'some data',
status: 0,
comments: 'some data',
isBlocked: false,
isCompleted: false,
index: 1
}
]
}