Skip to content

[Feature]: add generic type for job progress #3721

@skrukwa

Description

@skrukwa

Unless I am mistaken, the progress type is hardcoded to type JobProgress = string | boolean | number | object.

It would be very nice to be able to specify the type. Maybe a 4th parameter to the Worker class?

const worker = new Worker<Input, Output, string, { percent: number; msg: string }>(...);

// TypeScript should correctly infer 'progress' here
worker.on('progress', (job, progress) => {
    console.log(progress.msg); // OK
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions