New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript class declaration – superfluous generic parameter #472
Comments
It is used for the job's return data type https://github.com/taskforcesh/bullmq/blob/master/src/classes/queue.ts#L64 |
@manast thanks for responding so quickly. The add(name: N, data: T, opts?: JobsOptions): Promise<Job<any, any, string>>; So when I do this: const queue = new Queue<number, string>(name);
const job = queue.add("my job", 12); my Sorry for not being able to dig any deeper right now. But I definitely think this is a bug and would kindly ask you to re-open. |
yes, I can see what you mean. But what is the bug? the code seems correctly to me, a bug in Typescript perhaps? if you know why the .d.ts is ignoring the R generic type please share it with me. |
I'm in a bit of a hurry today … hopefully I'll be able to have a closer look tomorrow or over the weekend. Nothing beats debugging weird TS stuff on a Sunday afternoon 😊 |
Hi @manast , just had another look. The problem is based on the I added a PR to address this. Would be great if you found the time to check it out. As a side note: For |
In the
dist/classes/queue.d.ts
you can find this class declaration:But the generic parameter
R
is never actually used. This makes using the class a bit awkward, since (if you want to provide a custom argument forN
) you have to provide a meaningless dummy value forR
. That is, after you've found out that is has no real purpose in the first place.Am I missing something here? Or should
R
be dropped altogether?The text was updated successfully, but these errors were encountered: