chore(cli): HandlerArgv type#1933
Conversation
✅ Deploy Preview for cedarjs canceled.
|
Greptile SummaryThis PR removes the
Confidence Score: 4/5Safe to merge — purely a typing refactor with no behavioural changes to any generator or destroy command. All runtime behaviour is unchanged; the
Important Files Changed
Reviews (1): Last reviewed commit: "chore(cli): HandlerArgv type" | Re-trigger Greptile |
| type FunctionFilesArgv = HandlerArgv & { | ||
| typescript?: boolean | ||
| tests?: boolean | ||
| } |
There was a problem hiding this comment.
tests is already declared as tests?: boolean in HandlerArgv, so re-declaring it in the intersection type is redundant.
| type FunctionFilesArgv = HandlerArgv & { | |
| typescript?: boolean | |
| tests?: boolean | |
| } | |
| type FunctionFilesArgv = HandlerArgv & { | |
| typescript?: boolean | |
| } |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| { | ||
| title: `Destroying ${componentName} files...`, | ||
| task: async () => { | ||
| const f = await filesFn({ name, stories: true, tests: true }) | ||
| // The destroy flow always passes the same fixed set of fields to | ||
| // the generator's `files` function. We assert to TFilesArgs here | ||
| // because the caller is generic over what those extra fields are. | ||
| const f = await filesFn({ | ||
| name, | ||
| stories: true, | ||
| tests: true, |
There was a problem hiding this comment.
as unknown as TFilesArgs bypasses the generic bound
The double-cast hides any mismatch between the fixed { name, stories: true, tests: true } object and what TFilesArgs actually requires. If a future caller binds TFilesArgs to a type that has a required non-optional field beyond name, the compiler will silently accept the cast while the runtime will receive undefined for that field. Constraining the type parameter — e.g. TFilesArgs extends { name: string; stories?: boolean; tests?: boolean } — would surface exactly those cases at the call site without needing the double-cast.
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 2s | View ↗ |
nx run-many -t build |
✅ Succeeded | <1s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-16 20:22:03 UTC

Use
HandlerArgvin as many places as possible to DRY up the code