surreal-zod 0.0.0-alpha.11 → 0.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/zod/utils.ts CHANGED
@@ -1,6 +1,16 @@
1
- import * as core from "zod/v4/core";
2
- import type { SurrealZodTableFields } from "./schema";
1
+ export type UnionToIntersection<U> = (
2
+ U extends any
3
+ ? (x: U) => void
4
+ : never
5
+ ) extends (x: infer I) => void
6
+ ? I
7
+ : never;
3
8
 
4
- export const optionalFields = core.util.optionalKeys as (
5
- fields: SurrealZodTableFields,
6
- ) => string[];
9
+ export type LastOf<U> =
10
+ UnionToIntersection<U extends any ? () => U : never> extends () => infer L
11
+ ? L
12
+ : never;
13
+
14
+ export type UnionToTuple<U, T extends any[] = []> = [U] extends [never]
15
+ ? T
16
+ : UnionToTuple<Exclude<U, LastOf<U>>, [LastOf<U>, ...T]>;