/** A value successfully returned from an operation or an `Error`. */export type Result<T> = T | Error; /** Checks if a `Result` has a non-error value. */export const ok = <T>(r: Result<T>): r is T => !(r instanceof Error); // Code sample derived from <a href="/typescript-result-type">this article</a>.