Skip to content

Commit

Permalink
update after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Sep 5, 2023
1 parent 8eaf2a7 commit 84c8ef4
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 173 deletions.
4 changes: 2 additions & 2 deletions src/conditions/zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { Primitive, z, ZodLiteral } from 'zod';

// Source: https://github.com/colinhacks/zod/issues/831#issuecomment-1063481764
const createUnion = <
T extends Readonly<[Primitive, Primitive, ...Primitive[]]>
T extends Readonly<[Primitive, Primitive, ...Primitive[]]>,
>(
values: T
) => {
const zodLiterals = values.map((value) => z.literal(value)) as unknown as [
ZodLiteral<Primitive>,
ZodLiteral<Primitive>,
...ZodLiteral<Primitive>[]
...ZodLiteral<Primitive>[],
];
return z.union(zodLiterals);
};
Expand Down
Loading

0 comments on commit 84c8ef4

Please sign in to comment.