mike-marcacci / node-redlock

A node.js redlock implementation for distributed, highly-available redis locks
MIT License
1.85k stars 173 forks source link

Typescript typings dont work with bundler moduleResolution #307

Open steelbrain opened 1 month ago

steelbrain commented 1 month ago

Hello!

Thanks for making this package! It seems that typings are broken when tsconfig sets module resolution to bundler. Here's a repository with a reproduction: https://github.com/steelbrain/bug-reproduction-2024-10-redlock

Here's the error message

There are types at 'bug-reproduction-2024-10-redlock/node_modules/redlock/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'redlock' library may need to update its package.json or typings.

steelbrain commented 1 month ago

Ah. It seems to be fixed in the repository but not released. https://github.com/mike-marcacci/node-redlock/commit/06d9f5cae1439696467008ebe98a705e6ba9821e

ethos-seth commented 3 weeks ago

Anyone know a workaround for this?

rdadoune commented 2 weeks ago

I use pnpm, which allows you to patch. So I just patched the package.json file to update the exports like this:

"exports": {
   ".": {
     "types": "./dist/index.d.ts",
     "import": "./dist/esm/index.js",
     "require": "./dist/cjs/index.js"
   }
}