Skip to content

Commit d34a369

Browse files
0.8.3
1 parent 2615a26 commit d34a369

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zod_utilz",
3-
"version": "0.8.2",
3+
"version": "0.8.3",
44
"author": "JacobWeisenburger",
55
"description": "Framework agnostic utilities for Zod",
66
"license": "MIT",

src/useTypedParsers.test.ts

+11
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,15 @@ test( 'README Example', () => {
5555
// ^^^^^
5656
// Argument of type '"bar"' is not assignable to parameter of type '"foo"'
5757
).toThrow()
58+
} )
59+
60+
test( 'https://github.com/JacobWeisenburger/zod_utilz/issues/13', () => {
61+
const DEFAULT_CONCURRENCY = 1
62+
const schema = z.number().int().min( 1 ).default( DEFAULT_CONCURRENCY )
63+
const typedSchema = zu.useTypedParsers( schema )
64+
type Input = z.input<typeof typedSchema>
65+
// type Input = number | undefined
66+
type Output = z.output<typeof typedSchema>
67+
// type Output = number
68+
typedSchema.parse( undefined )
5869
} )

src/useTypedParsers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type ParametersExceptFirst<Func> =
2525
Func extends ( arg0: any, ...rest: infer R ) => any ? R : never
2626

2727
type Params<Schema extends z.ZodType, Method extends ParseMethods> = [
28-
data: z.infer<Schema>,
28+
data: z.input<Schema>,
2929
...rest: ParametersExceptFirst<Schema[ Method ]>
3030
]
3131

0 commit comments

Comments
 (0)