Add typegen for workflow contexts to help using createWorkflow#153
Merged
Add typegen for workflow contexts to help using createWorkflow#153
createWorkflow#153Conversation
CLI tool (`generate-types`) to generate types for WorkflowContexts defined in a tenant for type safety when using `createWorkflow`
74204b0 to
f92ca4d
Compare
jpeters5392
reviewed
Apr 15, 2026
|
|
||
| for (let i = 0; i < args.length; i++) { | ||
| if (args[i] === "--output" || args[i] === "-o") { | ||
| output = args[++i]; |
Contributor
There was a problem hiding this comment.
Would it be worth it to add proper argument checking here? In this case I could see checking that there is a next argument and it doesn't start with -, similar to how most of the other CLI parsing libraries handle it.
Contributor
Author
There was a problem hiding this comment.
That's good feedback. Swapped to node's built-in.
jpeters5392
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
generate-typesCLI tool that fetches workflow context schemas to generate type declarations to improve the type-safety of usingcreateWorkflowUsage
Then add the generated file to your
tsconfig.json:{ "include": ["prismatic.d.ts"] }Review Peculiarities
export {}in generated output — required so TypeScript treats the file as a module augmentation rather than an ambient module declaration (which would replace the module's types entirely)stableKeys that produce the same PascalCase type name (e.g.my-workflowandmyWorkflowboth →MyWorkflowContext) get suffixed asMyWorkflowContext1,MyWorkflowContext2. This is all internal to the module augmentation so it doesn't matter.tsconfig.generators.jsoncompilessrc/generators/to CommonJS independently from the webpack build