Skip to content

Commit

Permalink
0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobWeisenburger committed Jun 14, 2024
1 parent 2615a26 commit d34a369
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zod_utilz",
"version": "0.8.2",
"version": "0.8.3",
"author": "JacobWeisenburger",
"description": "Framework agnostic utilities for Zod",
"license": "MIT",
Expand Down
11 changes: 11 additions & 0 deletions src/useTypedParsers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,15 @@ test( 'README Example', () => {
// ^^^^^
// Argument of type '"bar"' is not assignable to parameter of type '"foo"'
).toThrow()
} )

test( 'https://github.com/JacobWeisenburger/zod_utilz/issues/13', () => {
const DEFAULT_CONCURRENCY = 1
const schema = z.number().int().min( 1 ).default( DEFAULT_CONCURRENCY )
const typedSchema = zu.useTypedParsers( schema )
type Input = z.input<typeof typedSchema>
// type Input = number | undefined
type Output = z.output<typeof typedSchema>
// type Output = number
typedSchema.parse( undefined )
} )
2 changes: 1 addition & 1 deletion src/useTypedParsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type ParametersExceptFirst<Func> =
Func extends ( arg0: any, ...rest: infer R ) => any ? R : never

type Params<Schema extends z.ZodType, Method extends ParseMethods> = [
data: z.infer<Schema>,
data: z.input<Schema>,
...rest: ParametersExceptFirst<Schema[ Method ]>
]

Expand Down

0 comments on commit d34a369

Please sign in to comment.