0.1.1 #2

Merged
Thilawyn merged 47 commits from next into master 2024-01-17 20:47:13 +01:00
Showing only changes of commit 9467453042 - Show all commits

View File

@@ -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