Closed mariorodriguespt closed 3 years ago
Found a temporary fix in previous tickets for those in urgent need:
change your import to import Fuse from 'fuse.js/dist/fuse.min.js'
Having the exact same problem.
import Fuse from 'fuse.js/dist/fuse.min.js'
works for me aswell!
Great but how to make this work in TypeScript?
import Fuse from 'fuse.js/dist/fuse.min.js'
gives me:
Could not find a declaration file for module 'fuse.js/dist/fuse.min.js'. '/Users/mliquori/prequal-web/node_modules/fuse.js/dist/fuse.min.js' implicitly has an 'any' type.
Try `npm install @types/fuse.js` if it exists or add a new declaration (.d.ts) file containing `declare module 'fuse.js/dist/fuse.min.js';`ts(7016)
Use tslint ignore next line @mliq
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
Commenting to avoid closing without a fix.
Looks like this is due to the the spread operator being including in the module
builds. AFAIK, module
should be reserved for ES5 syntax + import/export.
We're running into this as well. I don't think this should be closed.
@mliq I copy-pasted the original fuse.d.ts
to my sources (src/fuse.js__dist__fuse.min.js.d.ts
) and wrapped it in declare module 'fuse.js/dist/fuse.min.js'
, and replaces the declare
s from there with export
s, ie. like
declare module 'fuse.js/dist/fuse.min.js' {
export default Fuse;
export class Fuse<T> {
...
}
Now builds when used import Fuse from 'fuse.js/dist/fuse.min.js';
and types work and works also on IE11 which was the actual, rather sad requirement.
Even easier then copy pasting:
declare module 'fuse.js/dist/fuse.min.js' {
import Fuse from 'fuse.js';
export default Fuse;
}
Describe the bug
I'm using core-js and webpack for development and production. On IE11 my app doesn't run, after commenting the import of my components that use fuse.js, it works flawlessly.
Version
6.4.1
Is this a regression?
I found old closed tickets with a similar issue: https://github.com/krisk/Fuse/issues?q=is%3Aissue+is%3Aclosed+ie11
🔬Minimal Reproduction