Skip to content

Commit

Permalink
Updates example
Browse files Browse the repository at this point in the history
  • Loading branch information
anglinb committed Jul 29, 2021
1 parent 84aa7be commit 814a5ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions example/heros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ export enum EnemyPower {
Speed = "speed",
}

export type SpeedEnemy = {
power: EnemyPower.Speed;
};

export interface Enemy {
name: string;
powers: EnemyPower[];
Expand Down
4 changes: 4 additions & 0 deletions example/heros.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { EnemyPower, Villain } from "./heros";

export const enemyPowerSchema = z.nativeEnum(EnemyPower);

export const speedEnemySchema = z.object({
power: z.literal(EnemyPower.Speed),
});

export const enemySchema = z.object({
name: z.string(),
powers: z.array(enemyPowerSchema),
Expand Down

0 comments on commit 814a5ce

Please sign in to comment.