【发布时间】:2019-08-22 08:26:01
【问题描述】:
我需要为外部 (npm) 库编写一个 .d.ts 文件。我正在使用打字稿 3。
我需要的进口是:
import fakedb from 'fake-indexeddb'; //sorted
// second import I would like:
import dbKeyRange from 'fake-indexeddb/lib/FDBKeyRange'
来自 types/fake-indexeddb.d.ts:
export = index;
declare const index: IDBFactory;
如何为我想要的库中的第二次导入编写文件(fake-indexeddb/lib/FDBKeyRange - IDBKeyRange)?
编辑
虽然 Juraj Kocan 的答案在逻辑上是我必须放入 .d.ts 文件中的内容,但问题是我必须为文件命名,以便调试器和转译器在我编写 import dbKeyRange from 'fake-indexeddb/lib/FDBKeyRange' 时找到该文件 - 很明显它如何找到 types/fake-indexeddb.d.ts 文件。
【问题讨论】:
标签: typescript .d.ts