makeJsonifiableSchemableClass fix
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -33,7 +33,6 @@ export function makeJsonifiableSchemableClass<
|
|||||||
|
|
||||||
Type extends ClassType = "AbstractClass"
|
Type extends ClassType = "AbstractClass"
|
||||||
>(
|
>(
|
||||||
props: {
|
|
||||||
extend: C | SchemableClass<
|
extend: C | SchemableClass<
|
||||||
SchemaT,
|
SchemaT,
|
||||||
SchemaUnknownKeys,
|
SchemaUnknownKeys,
|
||||||
@@ -41,8 +40,9 @@ export function makeJsonifiableSchemableClass<
|
|||||||
Values,
|
Values,
|
||||||
DefaultValues,
|
DefaultValues,
|
||||||
Type
|
Type
|
||||||
>
|
>,
|
||||||
|
|
||||||
|
props: {
|
||||||
jsonifySchema: (props: {
|
jsonifySchema: (props: {
|
||||||
schema: C["schema"]
|
schema: C["schema"]
|
||||||
shape: C["schema"]["shape"]
|
shape: C["schema"]["shape"]
|
||||||
@@ -64,19 +64,19 @@ export function makeJsonifiableSchemableClass<
|
|||||||
Values,
|
Values,
|
||||||
JsonifiedValues
|
JsonifiedValues
|
||||||
>
|
>
|
||||||
}
|
},
|
||||||
) {
|
) {
|
||||||
const jsonifySchema = props.jsonifySchema({
|
const jsonifySchema = props.jsonifySchema({
|
||||||
schema: props.extend.schema,
|
schema: extend.schema,
|
||||||
shape: props.extend.schema.shape,
|
shape: extend.schema.shape,
|
||||||
})
|
})
|
||||||
|
|
||||||
const dejsonifySchema = props.dejsonifySchema({
|
const dejsonifySchema = props.dejsonifySchema({
|
||||||
schema: props.extend.schema,
|
schema: extend.schema,
|
||||||
shape: props.extend.schema.shape,
|
shape: extend.schema.shape,
|
||||||
})
|
})
|
||||||
|
|
||||||
return class extends props.extend {
|
return class extends extend {
|
||||||
static readonly jsonifySchema = jsonifySchema
|
static readonly jsonifySchema = jsonifySchema
|
||||||
readonly jsonifySchema = jsonifySchema
|
readonly jsonifySchema = jsonifySchema
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ const UserProto = makeSchemableClass(z.object({
|
|||||||
UserProto.defaultValues
|
UserProto.defaultValues
|
||||||
|
|
||||||
|
|
||||||
const JsonifiableUserProto = makeJsonifiableSchemableClass({
|
const JsonifiableUserProto = makeJsonifiableSchemableClass(UserProto, {
|
||||||
extend: UserProto,
|
|
||||||
|
|
||||||
jsonifySchema: ({ schema, shape }) => schema.extend({
|
jsonifySchema: ({ schema, shape }) => schema.extend({
|
||||||
id: jsonifyBigIntSchema(shape.id)
|
id: jsonifyBigIntSchema(shape.id)
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user