0.1.2 #3
10
package.json
10
package.json
@@ -48,12 +48,12 @@
|
||||
"clean:node": "rm -rf node_modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"@thilawyn/traitify-ts": "^0.1.13",
|
||||
"@thilawyn/traitify-ts": "^0.1.14",
|
||||
"decimal.js": "^10.4.3",
|
||||
"effect": "^2.4.0",
|
||||
"effect": "^2.4.1",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mobx": "^6.12.0",
|
||||
"type-fest": "^4.10.3",
|
||||
"type-fest": "^4.12.0",
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -62,11 +62,11 @@
|
||||
"bun-types": "latest",
|
||||
"npm-check-updates": "^16.14.15",
|
||||
"npm-sort": "^0.0.4",
|
||||
"rollup": "^4.12.0",
|
||||
"rollup": "^4.12.1",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-ts": "^3.4.5",
|
||||
"ts-functional-pipe": "^3.1.2",
|
||||
"tsx": "^4.7.1",
|
||||
"typescript": "^5.3.3"
|
||||
"typescript": "^5.4.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ImplStaticThis, trait } from "@thilawyn/traitify-ts"
|
||||
import { ImplStatic, trait } from "@thilawyn/traitify-ts"
|
||||
import { Class, HasRequiredKeys } from "type-fest"
|
||||
import { z } from "zod"
|
||||
import { StaticMembers, parseZodSchemaEffect } from "../util"
|
||||
import { parseZodSchemaEffect } from "../util"
|
||||
|
||||
|
||||
type ParseParamsArgs = [] | [params: Partial<z.ParseParams>]
|
||||
@@ -32,7 +32,7 @@ export const ZodSchemaObject = <
|
||||
static readonly schema = schema
|
||||
static readonly schemaWithDefaultsValues = schemaWithDefaultValues
|
||||
|
||||
static instantiationTransform<
|
||||
static transform<
|
||||
Instance extends Values,
|
||||
|
||||
T extends z.ZodRawShape,
|
||||
@@ -53,12 +53,12 @@ export const ZodSchemaObject = <
|
||||
>(
|
||||
this: (
|
||||
Class<Instance, [values: Values]> &
|
||||
StaticMembers<ImplStaticThis<typeof ZodSchemaObject>>
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
) {
|
||||
return this
|
||||
.instantiationTransform(this.schemaWithDefaultsValues)
|
||||
.transform(this.schemaWithDefaultsValues)
|
||||
.parse(values, params)
|
||||
}
|
||||
|
||||
@@ -67,12 +67,12 @@ export const ZodSchemaObject = <
|
||||
>(
|
||||
this: (
|
||||
Class<Instance, [values: Values]> &
|
||||
StaticMembers<ImplStaticThis<typeof ZodSchemaObject>>
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
) {
|
||||
return this
|
||||
.instantiationTransform(this.schemaWithDefaultsValues)
|
||||
.transform(this.schemaWithDefaultsValues)
|
||||
.parseAsync(values, params)
|
||||
}
|
||||
|
||||
@@ -81,12 +81,12 @@ export const ZodSchemaObject = <
|
||||
>(
|
||||
this: (
|
||||
Class<Instance, [values: Values]> &
|
||||
StaticMembers<ImplStaticThis<typeof ZodSchemaObject>>
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
) {
|
||||
return parseZodSchemaEffect(
|
||||
this.instantiationTransform(this.schemaWithDefaultsValues),
|
||||
this.transform(this.schemaWithDefaultsValues),
|
||||
values,
|
||||
params,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user