ZodSchemaClassExtender
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2024-02-25 04:32:09 +01:00
parent 34ae4b9375
commit e7c65c0a07
3 changed files with 72 additions and 13 deletions

View File

@@ -6,18 +6,18 @@
export type CommonKeys<A, B> = Extract<keyof A, keyof B>
export type Extend<T extends readonly object[]> = (
T extends [
T extends readonly [
infer Super,
infer Self,
...infer Rest extends object[],
...infer Rest extends readonly object[],
]
? Pick<Self, CommonKeys<Self, Super>> extends Pick<Super, CommonKeys<Self, Super>>
? Extend<[
? Extend<readonly [
Omit<Super, CommonKeys<Self, Super>> & Self,
...Rest,
]>
: never
: T extends [infer Self]
: T extends readonly [infer Self]
? Self
: {}
)