Error in Recursive Schema Creation
I'm trying to make a recursive schema but I'm getting an error like this:
Anyone know why that might be? They seem compatible to me.
Anyone know why that might be? They seem compatible to me.
type
'Schema<
{ readonly id: string; readonly children?: readonly Node[]; },
{ readonly id: string; readonly children?: readonly Node[]; }>'
is not assignable to type 'Schema<Node, Node>'.const _Node = S.struct({ id: S.string })
interface Node extends S.To<typeof _Node> { children?: Node[] }
const Node: S.Schema<Node> = S.lazy(
() => S.extend(S.struct({ children: S.optional(S.array(Node)) }))(_Node)
)