error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("fuse.js")' call instead. To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with { "type": "module" }.
Description of the bug
fuse.js v7.0.0
import
tsconfig.json (https://github.com/tsconfig/bases/blob/main/bases/node20.json)
package.json
typescript error
Based on comments in this thread, this package incorrectly exports typings. https://github.com/microsoft/TypeScript/issues/53045#issuecomment-1452605559
The error was resolved when I copied
fuse.d.ts
tofuse.d.cts
and manually editednode_modules/fuse.js/package.json
Seems like fuse.js needs to expose
d.cts
andd.ts
.