This commit is contained in:
@@ -33,7 +33,7 @@ type SchemableClass<
|
||||
)
|
||||
|
||||
|
||||
export function extendWithZodSchema<
|
||||
export function extendSchemable<
|
||||
C extends SchemableClass<
|
||||
ExtendSchemaT,
|
||||
ExtendSchemaUnknownKeys,
|
||||
@@ -71,12 +71,16 @@ export function extendWithZodSchema<
|
||||
readonly schema = schema
|
||||
} as unknown as (
|
||||
Class<
|
||||
Omit<C, "schema"> &
|
||||
Omit<
|
||||
Omit<C, "schema">,
|
||||
keyof ExtendSchemaValues
|
||||
> &
|
||||
{ readonly schema: typeof schema } &
|
||||
SchemaValues,
|
||||
|
||||
ConstructorParameters<C>
|
||||
> &
|
||||
|
||||
Omit<StaticMembers<C>, "schema"> &
|
||||
{ readonly schema: typeof schema }
|
||||
)
|
||||
@@ -92,7 +96,7 @@ class Test1 {
|
||||
}
|
||||
|
||||
const Test2Schema = Test1.schema.extend({ prout: z.literal("ruquier"), ruquier: z.number() })
|
||||
const Test2 = extendWithZodSchema(Test1, Test2Schema)
|
||||
const Test2 = extendSchemable(Test1, Test2Schema)
|
||||
|
||||
Test2.schema
|
||||
new Test2().prout
|
||||
Reference in New Issue
Block a user