Inheritance logic refactoring
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:
@@ -2,16 +2,11 @@ import { Effect, pipe } from "effect"
|
||||
import { AbstractClass, Class as ConcreteClass, Opaque } from "type-fest"
|
||||
import { z } from "zod"
|
||||
import { DefinedDefaultValuesTag, NewZodSchemaInstanceArgs, NewZodSchemaInstanceInput, TZodSchemaClass } from "."
|
||||
import { Class, GetClassType, StaticMembers, parseZodTypeEffect } from "./util"
|
||||
import { Class, GetClassType, MergeInheritanceTree, MergeInheritanceTreeWithoutOverriding, StaticMembers, parseZodTypeEffect } from "./util"
|
||||
|
||||
|
||||
type ExtendableClass = AbstractClass<any, []> & {
|
||||
schema?: never
|
||||
defaultValues?: never
|
||||
}
|
||||
|
||||
export function ZodSchemaClassOf<
|
||||
Parent extends ExtendableClass,
|
||||
Parent extends AbstractClass<any, []>,
|
||||
|
||||
SchemaT extends z.ZodRawShape,
|
||||
SchemaUnknownKeys extends z.UnknownKeysParam,
|
||||
@@ -114,14 +109,18 @@ export function ZodSchemaClassOf<
|
||||
Class<
|
||||
GetClassType<Parent>,
|
||||
|
||||
InstanceType<Parent> &
|
||||
MergeInheritanceTreeWithoutOverriding<[
|
||||
InstanceType<Parent>,
|
||||
InstanceType<TZodSchemaClassImpl>,
|
||||
]> &
|
||||
|
||||
ConstructorParameters<TZodSchemaClassImpl>
|
||||
> &
|
||||
|
||||
StaticMembers<Parent> &
|
||||
StaticMembers<TZodSchemaClassImpl>
|
||||
MergeInheritanceTree<[
|
||||
StaticMembers<Parent>,
|
||||
StaticMembers<TZodSchemaClassImpl>,
|
||||
]>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user