lazy<T>(getSchema: Object): Schema<T>
getSchema: Object
type Tree = { left: Leaf | Tree, right: Leaf | Tree }type Leaf = string;const tree = x.object<Tree>({ get left(): x.Schema<Leaf | Tree> { return x.union(x.string, tree) }, get right(): x.Schema<Leaf | Tree> { return x.union(x.string, tree) },}) Copy
type Tree = { left: Leaf | Tree, right: Leaf | Tree }type Leaf = string;const tree = x.object<Tree>({ get left(): x.Schema<Leaf | Tree> { return x.union(x.string, tree) }, get right(): x.Schema<Leaf | Tree> { return x.union(x.string, tree) },})
type Tree = { left: Tree | Leaf, right: Tree | Leaf }type Leaf = string;const tree: x.ObjectSchema<Tree> = x.object({ left: x.lazy(() => x.union(x.string, tree)), right: x.lazy(() => x.union(x.string, tree)),}) Copy
type Tree = { left: Tree | Leaf, right: Tree | Leaf }type Leaf = string;const tree: x.ObjectSchema<Tree> = x.object({ left: x.lazy(() => x.union(x.string, tree)), right: x.lazy(() => x.union(x.string, tree)),})
Example: Prefer getters when possible
Example: using `x.lazy()`