-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(framework): Add InferWorkflowId
and InferWorkflowPayload
inference utility types
#6812
base: next
Are you sure you want to change the base?
Conversation
❌ Deploy Preview for novu-stg-vite-dashboard-poc failed. Why did it fail? →
|
commit: |
|
||
export type InferWorkflowId<T_Workflow extends Workflow> = T_Workflow extends Workflow<infer Id, never> ? Id : never; | ||
|
||
export type InferWorkflowPayload< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a lovely DX improvement, but I feel we need to add the BulkEventParams
and typedBulkTrigger
utilities to the framework to maximize its DX benefits.
The instructions we give Novu users feel more convoluted than hardcoding a workflowId
in a constant and reusing it in their code.
Alternatively, how about adding a triggerBulk function on the workflow object?
What changed? Why was the change needed?
workflowId
a generic type onDiscoverWorkflowOutput
and theworkflow
resource to allow the identifier to be inferredInferWorkflowId
andInferWorkflowPayload
inference utilsRelated Docs PR: novuhq/docs#726
Screenshots
See the Stackblitz example for live type-safety
https://stackblitz.com/edit/novu-type-safe-bulk-trigger?file=api%2Fnovu%2Froute.tsx&view=editor
Expand for optional sections
Related enterprise PR
Special notes for your reviewer