Мне нужна помощь, чтобы понять, как правильно создать файл .d.ts.
Меня поразило то, что некоторые люди используют этот синтаксис:
// lib-a.d.ts
namespace My.Foo.Bar {
interface IFoo {}
interface IBar {}
}
vs.
// lib-b.d.ts
declare namespace My.Foo.Bar {
interface IFoo {}
interface IBar {}
}
vs.
// lib-c.d.ts
namespace My.Foo.Bar {
export interface IFoo {}
export interface IBar {}
}
vs.
// lib-d.d.ts
declare namespace My.Foo.Bar {
export interface IFoo {}
export interface IBar {}
}
vs.
// lib-e.d.ts
declare module My.Foo.Bar {
export interface IFoo {}
export interface IBar {}
}
Который правильный? Для чего используется декларация? Для чего используется экспорт? Когда использовать пространство имен по сравнению с модулем?