Argument of type 'string' is not assignable to parameter of type 'ExtractNameType<DataTypeOrJob, DefaultNameType>
Im getting an error upgrading to 5.56.8 from 5.7.1 when trying to add a job to the queue.
The error is error TS2345: Argument of type 'string' is not assignable to parameter of type 'ExtractNameType<DataTypeOrJob, DefaultNameType>'. NameType extends string, so a string should work. https://api.docs.bullmq.io/classes/v5.Queue.html#constructorqueuenametype
I can see on the unit tests a string is used too. https://github.com/taskforcesh/bullmq/blob/master/tests/test_queue.ts#L47
const jobId = `${uid.toHexString()}-${importId.toString()}`;
const jobName: string = `deleteImport:${jobId}`;
const jobData: ImportDeletionJobData = {
uid: uid.toHexString(),
importId: importId.toHexString(),
importType,
};
await importDeletionQueue.add(jobName, jobData);
- here is my queue.
export const importDeletionQueue = new Queue<ImportDeletionJobData, any, string>(
IMPORT_DELETE_QUEUE,
{
// @ts-expect-error - bullmq types are incorrect
connection: getRedisClient(RedisClient.BullMQ) as IORedis.Redis,
defaultJobOptions,
},
);
My TypeScript compiler version is 5.4.5
bump
Have you tried omitting the third generic parameter? (not a fix but a workaround):
export const importDeletionQueue = new Queue<ImportDeletionJobData, any>(
IMPORT_DELETE_QUEUE,
{
connection: getRedisClient(RedisClient.BullMQ) as IORedis.Redis,
defaultJobOptions,
},
);
Have you tried omitting the third generic parameter? (not a fix but a workaround):
export const importDeletionQueue = new Queue<ImportDeletionJobData, any>( IMPORT_DELETE_QUEUE, { connection: getRedisClient(RedisClient.BullMQ) as IORedis.Redis, defaultJobOptions, }, );
Appreciate the suggestion. I think I tried this approach, but ill let you know for sure.
Having the same issue!