export type TestResultValid = { valid: true; }; export declare const valid: () => TestResultValid; export type TestResultInvalid = { valid: false; details: T; }; /** * Convenience method to return an InvalidTest object. * @param message * @param info * @returns */ export declare const invalid: (info: InvalidInfo) => TestResultInvalid; /** * A TestResult represents the outcome of a test applied to some data. For example, a test * could be checking if a string value can be converted to the dataType of a given field, or it * could test if a number value passes all restrictions provided for a field. * * If a test is valid, no additional data is added to the result. If it is invalid, then the * reason (or array of reasons) for why the test failed should be given. To make this type * reusable, the specific type of the invalid info is left as a generic. * * There are convenience methods available to return valid() and invalid(info) objects: * * @example * if(hasFailure) { * return invalid(reason); * } * return valid(); */ export type TestResult = TestResultValid | TestResultInvalid;