• Decoder that only accepts a specific value.

    Type Parameters

    • T

    Parameters

    • value: T

      The exact value to accept

    Returns Decoder<T>

    A decoder that only accepts the specified value

    const oneDecoder = JsonDecoder.isExactly(1);

    oneDecoder.decode(1); // Ok<number>({value: 1})
    oneDecoder.decode(2); // Err({error: '2 is not exactly 1'})