Type Alias ParsingResult<T>

ParsingResult<T>: {
    invalidReason?: T;
    invalidReasonMessage?: string;
    valid: boolean;
}

Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function, this type is returned from "defensive" functions like isValid.

Type Parameters

  • T

Type declaration

  • OptionalinvalidReason?: T

    If valid is false, this will be a code explaining why parsing failed.

  • OptionalinvalidReasonMessage?: string

    If valid is false, this will be a string explaining why parsing failed.

  • valid: boolean

    True if valid, false otherwise.