DavidTimms / DavidTimms/zod-fast-check
Getting `Uncaught TypeError: Cannot read properties of undefined (reading 'typeName')` when .inputOf(ZodRecord)
- Dominant language
- TypeScript
- Stars
- 130
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Just tried using the library and did:
```
$ node
> const z = await import('zod')
> const ZFC = await import('zod-fast-check')
> const fc = await import('fast-check')
> let P = z.record({
name: z.string(),
age: z.number(),
location: z.string()
})
> ZFC.ZodFastCheck().inputOf(P)
Uncaught TypeError: Cannot read properties of undefined (reading 'typeName')
at isFirstPartyType (./node_modules/zod-fast-check/dist/zod-fast-check.js:104:34)
at _ZodFastCheck.inputWithPath (./node_modules/zod-fast-check/dist/zod-fast-check.js:55:13)
at ZodRecord (./node_modules/zod-fast-check/dist/zod-fast-check.js:257:84)
at _ZodFastCheck.inputWithPath (./node_modules/zod-fast-check/dist/zod-fast-check.js:57:20)
at _ZodFastCheck.inputOf (./node_modules/zod-fast-check/dist/zod-fast-check.js:40:21)
```
Seems to happen when trying to `recurse` using the value type in the builder function for ZodRecord
Wasn't able to figure out why this is passing in a raw dictionary for the value type and trying to recurse on the whole thing (instead of recursing item by item and then combining them at the end).
Can you help me get this working?
```
zod 3.24.1
zod-fast-check 0.10.1
fast-check 3.23.2
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the ZodRecord case with zod 3.24.1, zod-fast-check 0.10.1, and fast-check 3.23.2. Start at the inputOf and ZodRecord paths shown in dist/zod-fast-check.js, then inspect isFirstPartyType and inputWithPath. Done means the reported record schema no longer throws the typeName error and produces the expected fast-check input.
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
- 45/100