@telostat/prelude - v0.7.0
    Preparing search index...

    Variable Codec

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

        Returns Codec<T>

    • interface: function
      • Creates a codec for any JSON object

        Type Parameters

        • T extends Record<string, Codec<any>>

        Parameters

        • properties: T

        Returns Codec<{ [k in string | number | symbol]: GetType<T[k]> }>