Typescript - 将类型定义从一个文件导入到另一个文件

dar*_*ong 5 typescript typescript-typings

给定以下文件,如何将定义从 bar.d.ts 导入到 foo.d.ts 命名空间?

我的目标是能够将模块声明导入另一个模块,并将其添加到命名空间。

// bar.d.ts
declare module 'IBarService' {
    export function method (url: string): ng.IPromise<any>;
}

// foo.d.ts
/// <reference path="bar.d.ts" />

export as namespace Foo;

export = Foo;

declare namespace Foo {
    // import methods from IBarService. But how?
}
Run Code Online (Sandbox Code Playgroud)

任何帮助都会很棒。关于如何在不同项目之间重用自定义定义的任何见解也会很棒。