@traversable/schema
    Preparing search index...

    Type Alias fromJson<T>

    fromJson: [T] extends [readonly []]
        ? z.ZodArray<z.ZodUnknown>
        : [T] extends [readonly [any]]
            ? z.ZodArray<fromJson<T>>
            : [T] extends [readonly any[]]
                ? z.ZodArray<z.ZodUnion<{ [K in keyof T]: fromJson<T[K]> }>>
                : [T] extends [Record<string, any>]
                    ? z.ZodObject<{ [K in keyof T]: fromJson<T[K]> }, z.core.$loose>
                    : [T] extends [null | undefined]
                        ? z.ZodNull
                        : [T] extends [boolean]
                            ? z.ZodBoolean
                            : [T] extends [number]
                                ? z.ZodNumber
                                : [T] extends [string] ? z.ZodString : never

    Convert a blob of JSON data into a zod schema that represents that blob's greatest lower bound.

    Type Parameters

    • T
    import { zx } from '@traversable/zod'

    let ex_01 = zx.fromJson({ abc: 'ABC', def: [] })
    // ^? let ex_01: z.ZodObject<{ abc: z.ZodString, def: z.ZodArray<z.ZodUnknown> }>

    console.log(zx.toString(ex_01))
    // => z.object({ abc: z.string(), def: z.array(z.unknown()) })

    let ex_02 = zx.fromJson({ abc: false, def: [123] })
    // ^? let ex_02: z.ZodObject<{ abc: z.ZodBoolean, def: z.ZodArray<z.ZodNumber> }>

    console.log(zx.toString(ex_02))
    // => z.object({ abc: z.boolean(), def: z.array(z.number()) })

    let ex_03 = zx.fromJson({ abc: 123, def: ['ABC', null] })
    // ^? let ex_02: z.ZodObject<{ abc: z.ZodNumber, def: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNull]>> }>

    console.log(zx.toString(ex_03))
    // => z.object({ abc: z.number(), def: z.array(z.union([z.string(), z.null()])) })