recursive type
I'm trying to declare a dynamic tree structure for layouts (similar to HTML). Is it possible to have a recursive type? I'm trying this
but getting error
Block-scoped variable 'node_eurofutur' used before its declaration.
5 Replies
I don't think Convex validators support this currently.
ok i'm thinking as a plan B i can use a string as an emmet notation and hydrate it on the client side
or not sure if Convex validators support JSON
any
as a typeYou store pretty much any JSON in Convex directly with v.any().
You can even pretend the type is checked with
v.any() as Validator<MyType>
But the validation will be up to you at your callsites.Using branded types in validators
If you have a more specific type than what you can express with Convex validators, you can still document that at the type level in Convex by casting ...
sounds good, that might work