I need to write a .d.ts file for an external (npm) library. I am using typescript 3.
The imports I need are:
import fakedb from 'fake-indexeddb'; //sorted
// second import I would like:
import dbKeyRange from 'fake-indexeddb/lib/FDBKeyRange'
from types/fake-indexeddb.d.ts:
export = index;
declare const index: IDBFactory;
How do I write a file for the second import from the library I would like(fake-indexeddb/lib/FDBKeyRange
- an IDBKeyRange
)?
Edit
while the answer by Juraj Kocan is logically what i have to put in the .d.ts file, the question is what do I have to name the file so the debugger and transpiler find the file when I write import dbKeyRange from 'fake-indexeddb/lib/FDBKeyRange'
- it is obvious how it finds the types/fake-indexeddb.d.ts file.
import dbKeyRange from 'fake-indexeddb/lib/FDBKeyRange'
the transpiler & debugger cannot find the type definition file (I have named it FDBKeyRange.d.ts) - I will add a question edit. – Apportionment