Codec: {
    custom<T>(
        __namedParameters: {
            decode: (value: unknown) => functional.Either<string, T>;
            encode: (value: T) => any;
            schema?: () => object;
        },
    ): functional.Codec<T>;
    interface<T extends Record<string, functional.Codec<any>>>(
        properties: T,
    ): functional.Codec<
        { [k in string
        | number
        | symbol]: functional.GetType<T[k]> },
    >;
}

Type declaration

  • custom:function
    • Creates a codec for any type, you can add your own deserialization/validation logic in the decode argument

      Type Parameters

      • T

      Parameters

      • __namedParameters: {
            decode: (value: unknown) => functional.Either<string, T>;
            encode: (value: T) => any;
            schema?: () => object;
        }

      Returns functional.Codec<T>

  • interface:function