node-redlock
node-redlock copied to clipboard
Added missing ESM types export condition first
Fixes #173
Supersedes #214 since types expression needs to come first.
This is a rather small change but a total blocker for using node16/nodenext module resolution in typescript. There is no workaround as according to the typescript team this should be fixed by package maintainers:
In short: if you encounter any package with a types package json entry but not types in a provided export map - report it as an issue on that package; they've (likely unintentionally) broken TS support.
@mike-marcacci Would it be possible to have this merged and released in an patch version?
I also ran into the same issue and need this fix in order to be able to use nodenext
module resolution. @mike-marcacci any chance this could get merged and released soon?
I would need this fixed as well, I would appreciate this being released soon too.
The workaround I did was to copy all the type definitions from index.d.ts
in the redlock package into a redlock.d.ts
file in my typings folder, wrapping them in a declare module ...
:
declare module "redlock" {
// Types from node_modules/redlock/dist/index.d.ts go here, with the "declare" keywords removed
import { EventEmitter } from "events";
import { Redis as IORedisClient, Cluster as IORedisCluster } from "ioredis";
type Client = IORedisClient | IORedisCluster;
// ...
}
For that to work you also have to add your typings folder into the typeRoots
property in your tsconfig:
{
"compilerOptions": {
"typeRoots": ["./node_modules/@types", "./typings"],
}
}
I would really appreciate this PR being merged and released soon, but at least in the meantime this works.
@mike-marcacci FYI this PR only adds a single line to package.json, so it should not be much work to review.
Our project migration to esm is currently blocked on this, can we have this merged @mike-marcacci ?
Not in favor of having a copy of the declaration file within our project.
@mike-marcacci FYI this PR only adds a single line to package.json, so it should not be much work to review.
Have been running with this change for months and can verify it is sound.
@mike-marcacci Can we get a release with this?
When is the release of this?
Does not seem to be a big change, could this be released soon please? Our esm transformation is put on hold because of one package :/
I cannot use this package in my typescript ESM project because this issue has not been released.
Also waiting on this to be realeased.
In the meantime, you can use this in your package.json
to use the ESM update:
"dependencies": {
"redlock": "git+https://github.com/mike-marcacci/node-redlock.git"
}
Is this project abandoned? There seems to be no chance of an npm release anytime soon?