Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created May 20, 2020 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/103d80de068728ac012f4f8465cdd050 to your computer and use it in GitHub Desktop.
Save Raynos/103d80de068728ac012f4f8465cdd050 to your computer and use it in GitHub Desktop.
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