Skip to content

Commit

Permalink
fix gro --help for ZodBranded type (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanatkn authored Jun 10, 2024
1 parent 615ba34 commit ba4ac8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/real-beds-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ryanatkn/gro': patch
---

fix `gro --help` for `ZodBranded` type
4 changes: 3 additions & 1 deletion src/lib/print_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ const to_args_schema_type = ({_def}: ZodTypeAny): Arg_Schema['type'] => {
case ZodFirstPartyTypeKind.ZodUnion:
return 'string | string[]'; // TODO support unions of arbitrary types, or more hardcoded ones as needed
default: {
if ('innerType' in _def) {
if ('type' in _def) {
return to_args_schema_type(_def.type);
} else if ('innerType' in _def) {
return to_args_schema_type(_def.innerType);
} else {
throw Error('Unknown zod type ' + t);
Expand Down

0 comments on commit ba4ac8f

Please sign in to comment.