• Encodes a sum type value with encoders and functions for index key.

    Type Parameters

    • O extends object

    • K extends PropertyKey = keyof O

    • T = Encoding<O[keyof O]>

    Parameters

    • variantEncoders: O

      Encoders for each variant of the sum type.

    Returns ((keyExtractor) => ((keyEncoder) => Encoder<T>))

    The encoder for the sum type.

      • (keyExtractor): ((keyEncoder) => Encoder<T>)
      • Parameters

        • keyExtractor: ((value) => K)
            • (value): K
            • Parameters

              • value: T

              Returns K

        Returns ((keyEncoder) => Encoder<T>)

Generated using TypeDoc