Fuse icon indicating copy to clipboard operation
Fuse copied to clipboard

Typescript definitions for fuse.basic are not being built and exported

Open youssefm opened this issue 2 years ago • 2 comments

Describe the bug

I was hoping to use fuse.basic because I don't need extended search.

But if you try to import fuse.basic like this in a node project:

import Fuse from "fuse.js/dist/fuse.basic";

You get the following typescript error:

Could not find a declaration file for module 'fuse.js/dist/fuse.basic'

It seems to me like a fuse.basic.d.ts file should be available in the dist folder of the package. Or that there should be a separate fuse.basic npm package that does export a type definition file.

Version

6.5.3

Is this a regression?

Doesn't seem like a regression

🔬Minimal Reproduction

Create a node typescript project, install fuse, try to import Fuse from the fuse.basic script.

youssefm avatar Apr 08 '22 03:04 youssefm

I'm not sure how to deal with this problem either, any file which isn't fuse.js will cause the same error.

Racide avatar Apr 08 '22 16:04 Racide

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] avatar Aug 07 '22 00:08 github-actions[bot]

While waiting for a fix, you could declare the module in your project using the declaration fuse.d.ts.

In a file with the extension .d.ts:

declare module 'fuse.js/dist/fuse.basic.esm' {
  import Fuse from 'fuse.js'
  export default Fuse
}

mickaelchanrion avatar Aug 30 '22 11:08 mickaelchanrion