We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here's a repro with vitest:
import { Type, type StaticDecode, type TSchema } from "@sinclair/typebox"; import { test } from "vitest"; import { Value } from "@sinclair/typebox/value"; export function Parse<T extends TSchema, R = StaticDecode<T>>( schema: T, value: unknown ): R { const cloned = Value.Clone(value); const cleaned = Value.Clean(schema, cloned); return Value.Decode(schema, cleaned); } const RecursiveSchema = Type.Recursive((This) => { return Type.Object({ id: Type.Number(), parent: Type.Optional(Type.Union([This, Type.Null()])), }); }); const inputs = [ { id: 1, parent: { id: 2, parent: { id: 3, }, }, }, ]; test("schema parses", () => { for (const input of inputs) { Parse(RecursiveSchema, input); } });
If I remove the union from parent to be like this: Type.Optional(This), then there's no trouble.
parent
Type.Optional(This)
The text was updated successfully, but these errors were encountered:
@truumahn Hi, thanks for reporting. This is definitely a bug!
I have pushed a version on 0.32.23 where this issue should be resolved. Relevant PR is here #847
If you just want to test things your side, can close off this issue Thanks again! S
Sorry, something went wrong.
Thank you, works perfectly!
No branches or pull requests
Here's a repro with vitest:
If I remove the union from
parent
to be like this:Type.Optional(This)
, then there's no trouble.The text was updated successfully, but these errors were encountered: