• Decoder that always fails with the given error message.

    Type Parameters

    • T

    Parameters

    • error: string

      The error message to return

    Returns Decoder<T>

    A decoder that always fails with the specified error

    const failDecoder = JsonDecoder.fail<string>('This decoder always fails');
    failDecoder.decode('anything'); // Err({error: 'This decoder always fails'})