zarr.js icon indicating copy to clipboard operation
zarr.js copied to clipboard

"Could not find a declaration file for module 'zarr'"

Open xinaesthete opened this issue 1 year ago • 3 comments

I don't seem to be able to import from zarr in TypeScript without getting this error:

Could not find a declaration file for module 'zarr'. '/project/node_modules/zarr/zarr.mjs' implicitly has an 'any' type. There are types at '/project/node_modules/zarr/types/zarr.d.ts', but this result could not be resolved when respecting package.json "exports". The 'zarr' library may need to update its package.json or typings.

This is with freshly created npm create vite@latest - I tried a couple of permutations of settings, nothing that made a difference. I also tried importing from 'zarr/core' - again, no different.

xinaesthete avatar Apr 08 '24 13:04 xinaesthete

The issue is with "moduleResolution": "bundler" in tsconfig.json (which is the default with npm create vite@latest as of this writing). Changing to "node" works.

xinaesthete avatar Apr 11 '24 12:04 xinaesthete

Getting the same error. Also changing to node seems to work. Maybe it would be a good idea to fix this issue directly in Zarr.js, instead of changing local configs?

lazarusA avatar May 20 '24 09:05 lazarusA

Would this PR fix this? https://github.com/gzuidhof/zarr.js/pull/149 Would be great to use zarr.js with "moduleResolution": "bundler"

kahole avatar Sep 03 '24 09:09 kahole