bullmq icon indicating copy to clipboard operation
bullmq copied to clipboard

[Question]: Job TypeScript Typings

Open dvins opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. Could someone in the know add some commentary or color on the thoughts behind how Job's are typed in TypeScript, particularly the intent behind the string-only NameType?

Describe the solution you'd like Some additional design documentation and guidance on how we should properly model or use this typing.

Describe alternatives you've considered Looking for guidance more than anything. It sort of gnaws at me every time I see it and I'm not sure I'm leveraging it either for or against me in any way that it is intended it be used.

Additional context Love BullMQ, awesome framework!

dvins avatar Apr 11 '23 06:04 dvins

For instance, if you want to just define a subset of valid job names, you could create a type like:

type MyJobNames = "foo" | "bar" | "baz";

They are still strings, but only those three would be allowed by the Typescript compiler.

manast avatar May 23 '24 16:05 manast