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