【发布时间】:2017-05-31 23:17:47
【问题描述】:
我需要帮助以了解创建 .d.ts 文件的正确方法。
让我震惊的是,有些人使用这种语法:
// lib-a.d.ts
namespace My.Foo.Bar {
interface IFoo {}
interface IBar {}
}
对比
// lib-b.d.ts
declare namespace My.Foo.Bar {
interface IFoo {}
interface IBar {}
}
对比
// lib-c.d.ts
namespace My.Foo.Bar {
export interface IFoo {}
export interface IBar {}
}
对比
// lib-d.d.ts
declare namespace My.Foo.Bar {
export interface IFoo {}
export interface IBar {}
}
对比
// lib-e.d.ts
declare module My.Foo.Bar {
export interface IFoo {}
export interface IBar {}
}
哪一个是正确的?声明是做什么用的?出口是做什么用的?何时使用命名空间与模块?
【问题讨论】:
标签: typescript visual-studio-2015 typescript-typings typescript1.8