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:
@@ -1,8 +1,9 @@
|
||||
import { Effect } from "effect"
|
||||
import { AbstractClass, Class as ConcreteClass } from "type-fest"
|
||||
import { JsonifiableObject } from "type-fest/source/jsonifiable"
|
||||
import { z } from "zod"
|
||||
import { SchemableClass } from ".."
|
||||
import { Class, ClassType, StaticMembers, parseZodTypeEffect } from "../util"
|
||||
import { StaticMembers, parseZodTypeEffect } from "../util"
|
||||
|
||||
|
||||
export type MakeJsonifiableSchemableClassProps<
|
||||
@@ -66,8 +67,7 @@ export function makeJsonifiableSchemableClass<
|
||||
SchemaUnknownKeys,
|
||||
SchemaCatchall,
|
||||
Values,
|
||||
DefaultValues,
|
||||
Type
|
||||
DefaultValues
|
||||
>,
|
||||
|
||||
SchemaT extends z.ZodRawShape,
|
||||
@@ -86,16 +86,13 @@ export function makeJsonifiableSchemableClass<
|
||||
DejsonifySchemaCatchall extends z.ZodTypeAny,
|
||||
|
||||
JsonifiedValues extends JsonifiableObject,
|
||||
|
||||
Type extends ClassType = "AbstractClass",
|
||||
>(
|
||||
extend: C | SchemableClass<
|
||||
SchemaT,
|
||||
SchemaUnknownKeys,
|
||||
SchemaCatchall,
|
||||
Values,
|
||||
DefaultValues,
|
||||
Type
|
||||
DefaultValues
|
||||
>,
|
||||
|
||||
props: MakeJsonifiableSchemableClassProps<
|
||||
@@ -116,6 +113,12 @@ export function makeJsonifiableSchemableClass<
|
||||
JsonifiedValues
|
||||
>,
|
||||
) {
|
||||
type Class<T, Arguments extends unknown[]> = (
|
||||
C extends ConcreteClass<any>
|
||||
? ConcreteClass<T, Arguments>
|
||||
: AbstractClass<T, Arguments>
|
||||
)
|
||||
|
||||
const jsonifySchema = props.jsonifySchema({
|
||||
schema: extend.schema,
|
||||
shape: extend.schema.shape,
|
||||
@@ -146,8 +149,6 @@ export function makeJsonifiableSchemableClass<
|
||||
}
|
||||
} as unknown as (
|
||||
Class<
|
||||
Type,
|
||||
|
||||
InstanceType<C> & {
|
||||
readonly jsonifySchema: typeof jsonifySchema,
|
||||
readonly dejsonifySchema: typeof dejsonifySchema,
|
||||
@@ -210,19 +211,15 @@ export function pipeMakeJsonifiableSchemableClass<
|
||||
SchemaUnknownKeys,
|
||||
SchemaCatchall,
|
||||
Values,
|
||||
DefaultValues,
|
||||
Type
|
||||
>,
|
||||
|
||||
Type extends ClassType = "AbstractClass",
|
||||
DefaultValues
|
||||
>
|
||||
>(
|
||||
extend: C | SchemableClass<
|
||||
SchemaT,
|
||||
SchemaUnknownKeys,
|
||||
SchemaCatchall,
|
||||
Values,
|
||||
DefaultValues,
|
||||
Type
|
||||
DefaultValues
|
||||
>
|
||||
) => makeJsonifiableSchemableClass(extend, props)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user