Skip to main content

jsonEncoderFromSchema

Callable

  • jsonEncoderFromSchema<T>(schema: ZodType<T, ZodTypeDef, T>): { decode: (input: string) => T; encode: (input: any) => string }

  • Type parameters

    • T = unknown

    Parameters

    • schema: ZodType<T, ZodTypeDef, T>

    Returns { decode: (input: string) => T; encode: (input: any) => string }

    • decode: (input: string) => T
        • (input: string): T
        • Parameters

          • input: string

          Returns T

    • encode: (input: any) => string
        • (input: any): string
        • Parameters

          • input: any

          Returns string