0.1.2 #3
@@ -26,7 +26,7 @@ const exp = zodSchemaClass
|
||||
@exp.staticImplements
|
||||
class User extends exp.extends implements Implements<typeof exp> {}
|
||||
|
||||
const inst = User.create({ id: 1n, name: "User" })
|
||||
const inst = User.create({ id: 1n, name: "User" }, )
|
||||
// console.log(inst.name)
|
||||
const instEffect = User.createEffect({ id: 1n, name: "User" })
|
||||
|
||||
|
||||
@@ -4,12 +4,10 @@ import { z } from "zod"
|
||||
import { parseZodSchemaEffect } from "../util"
|
||||
|
||||
|
||||
type ParseParamsArgs = [] | [params: Partial<z.ParseParams>]
|
||||
|
||||
type NewZodSchemaInstanceArgs<Input extends object> = (
|
||||
type CreateArgs<Input extends object> = (
|
||||
HasRequiredKeys<Input> extends true
|
||||
? [values: Input, ...args: ParseParamsArgs]
|
||||
: [] | [values: Input, ...args: ParseParamsArgs]
|
||||
? [values: Input, params?: Partial<z.ParseParams>]
|
||||
: [] | [values: Input, params?: Partial<z.ParseParams>]
|
||||
)
|
||||
|
||||
|
||||
@@ -55,7 +53,7 @@ export const ZodSchemaObject = <
|
||||
Class<Instance, [values: Values]> &
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
...[values, params]: CreateArgs<PartialValues>
|
||||
) {
|
||||
return this
|
||||
.transform(this.schemaWithDefaultsValues)
|
||||
@@ -69,7 +67,7 @@ export const ZodSchemaObject = <
|
||||
Class<Instance, [values: Values]> &
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
...[values, params]: CreateArgs<PartialValues>
|
||||
) {
|
||||
return this
|
||||
.transform(this.schemaWithDefaultsValues)
|
||||
@@ -83,7 +81,7 @@ export const ZodSchemaObject = <
|
||||
Class<Instance, [values: Values]> &
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
...[values, params]: CreateArgs<PartialValues>
|
||||
) {
|
||||
return parseZodSchemaEffect(
|
||||
this.transform(this.schemaWithDefaultsValues),
|
||||
|
||||
Reference in New Issue
Block a user