How to make a generic type from a js class?

37 Views Asked by At

I'm using Fuse.js and it's written in JS. To use it simply create an instance:

const fuse = new Fuse(data)

The type of fuse is just Fuse. I want it to automatically be more specified by making the type Fuse a generic. How can I do that?

Currently I have to manually type them like this:

const fuseData1: FuseData1 = new Fuse(data1)
const fuseData2: FuseData2 = new Fuse(data2)
0

There are 0 best solutions below