Closed spicemix closed 1 year ago
@spicemix Thanks for sharing this solution!
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
We also ran into this issue. The work around is sufficient, but will get out sync if upstream changes.
Describe the bug
When I try to import Fuse with the latest ES Modules version of Typescript 4.7, I have enormous difficulty working with the old namespace syntax Fuse is currently using.
Version
6.6.2
Is this a regression?
No.
🔬Minimal Reproduction
Create a typescript project with ES Modules (
package.json "type": "module"
etc) andimport Fuse from 'fuse.js'
;Additional context
To workaround this for the time being, I created a
custom-typings.d.ts
file at my src root with the following in it (although there it's insidedeclare module 'fuse.js' {...}
because it's in a globalcustom-typings.d.ts
), an extremely light edit of your existing type definitions, getting rid of the old namespace syntax. It's still imported and used the exact same way, as Fuse.js is still seen as a CommonJS module at runtime.You are free to use this in Fuse.js of course! I didn't want to go through the hassle of making a pull request if you think this is going to break too many old projects (would it?). But my experience is you are breaking future and current projects already with the old namespace syntax. Thanks for your work on Fuse.js!