Open markandrus opened 1 month ago
Inspired by this library, I have taken an approach using ts-morph to translate TypeScript types (rather, the subset of TypeScript types I depend on) to fast-check Arbitraries. The translation puts everything inside of an fc.letrec
and uses tie
wherever a recursive type appears. There is no type checking against the Zod schemas, although that could perhaps be combined…
Hi Mark. Thanks for the kind words.
I think I'd rather avoid every generated arbitrary being wrapped in fc.letrec
. In theory, an implementation based on fc.memo
should be possible. I anticipate that stopping it from generating infinite structures will a challenge though, which might require solving the halting problem :smile:
I'll leave this issue open and have a go at implementing it when I next get an opportunity to work on this lib.
I anticipate that stopping it from generating infinite structures will a challenge though, which might require solving the halting problem 😄
Yes! In fact I ran into this today and needed to reorder fc.oneof
entries so that the first one wasn't recursive: https://github.com/dubzzz/fast-check/issues/5218
I'll leave this issue open and have a go at implementing it when I next get an opportunity to work on this lib.
GL, and I'll be happy to try it out later 🙏
Very cool project! I hope to use it, but I have a recursive schema using
z.lazy
. Is it possible to add support for this? I suppose the project would have to usefc.letrec
orfc.memo
.