【发布时间】:2018-01-05 18:22:06
【问题描述】:
我想知道是否可以从一个打字稿 .d.ts 文件导出命名空间,然后将该命名空间导入另一个 .d.ts 文件,在该文件中在命名空间内使用它。
例子:
namespace_export.d.ts
export namespace Foo {
interface foo {
prop1: string;
}
}
types.d.ts
import { Foo } from './namespace_export'
export namespace Types {
Foo // <-- This doesn't work but is what I would like
interface Bar {
prop2: string
}
}
testfile.ts
import { Types } from './types'
function testTypes(type: Types.Foo.foo) {
console.log(type);
}
【问题讨论】:
标签: javascript typescript namespaces