ZodSchemaClassOf extend
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Julien Valverdé
2024-02-08 02:39:38 +01:00
parent ffce582e03
commit ed3f8fb643
3 changed files with 18 additions and 10 deletions

View File

@@ -9,10 +9,10 @@ export type CommonKeys<A, B> = Extract<keyof A, keyof B>
* Merges an inheritance tree defined by an array of types, considering overrides.
* @template T - An array of types representing the inheritance tree.
*/
export type MergeInheritanceTree<T extends readonly any[]> = (
export type Extend<T extends readonly any[]> = (
T extends [infer Super, infer Self, ...infer Rest]
? Pick<Self, CommonKeys<Self, Super>> extends Pick<Super, CommonKeys<Self, Super>>
? MergeInheritanceTree<[
? Extend<[
Omit<Super, CommonKeys<Self, Super>> & Self,
...Rest,
]>
@@ -26,10 +26,10 @@ export type MergeInheritanceTree<T extends readonly any[]> = (
* Merges an inheritance tree defined by an array of types without allowing overrides.
* @template T - An array of types representing the inheritance tree.
*/
export type MergeInheritanceTreeWithoutOverriding<T extends readonly any[]> = (
export type ExtendWithoutOverriding<T extends readonly any[]> = (
T extends [infer Super, infer Self, ...infer Rest]
? Pick<Self, CommonKeys<Self, Super>> extends Pick<Super, CommonKeys<Self, Super>>
? MergeInheritanceTreeWithoutOverriding<[
? ExtendWithoutOverriding<[
Super & Self,
...Rest,
]>

View File

@@ -1,4 +1,4 @@
export * from "./class"
export * from "./effect"
export * from "./inheritance"
export * from "./extend"
export * from "./misc"