-
-
Save Raynos/103d80de068728ac012f4f8465cdd050 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ValidationFail { | |
readonly validateErr: string | |
readonly ok: false | |
constructor(validateErr: string) { | |
this.validateErr = validateErr | |
this.ok = false | |
} | |
} | |
export class ValidationSuccess<T> { | |
readonly value: T | |
readonly ok: true | |
constructor(value: T) { | |
this.value = value | |
this.ok = true | |
} | |
} | |
export type ValidateResult<T> = ValidationSuccess<T> | ValidationFail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment