DavidTimms / DavidTimms/zod-fast-check

`.catch` is preventing zod-fast-check from working

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
130
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Using zod's `.catch` results in `Arbitrary`, but the issue is resolved when `.catch` is removed.

```json
"fast-check": "^3.23.2"
"zod": "^3.25.76"
"zod-fast-check": "^0.10.1"
```

```ts
const ThemeSchema = z.enum(["dark", "light"]).catch("dark");
const ThemeArbitrary = ZodFastCheck().inputOf(ThemeSchema); // Arbitrary
```
```ts
const ThemeSchema = z.enum(["dark", "light"]);
const ThemeArbitrary = ZodFastCheck().inputOf(ThemeSchema); // Arbitrary<"dark" | "light">
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the TypeScript snippet with fast-check 3.23.2, zod 3.25.76, and zod-fast-check 0.10.1, then trace the inputOf entry point with a schema using .catch. Done means the resulting arbitrary preserves the "dark" | "light" input type instead of becoming Arbitrary.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.