【发布时间】:2018-08-06 08:15:09
【问题描述】:
我正在为现有的功能模块库编写定义,该库公开了以下 API:
fn().from(opts: Options)
// and
fn().from.string(path: String)
我发现了关于声明合并here。它说明了多次声明一个具有相同名称的重载函数。但它并没有说明为一个函数和一个位于同一个地方的属性编写类型。
尽管如此,我还是尝试写作:
export interface Test {
from(path: string): ToOptionsBuilder;
}
export interface Test {
from: FromOptionsBuilder;
}
但正如预期的那样,编译器抱怨:Subsequent property declarations must have the same type.
我能做些什么吗?
如有需要,图书馆是markdown-pdf。
【问题讨论】:
标签: typescript typescript-typings