Check if a result is successful.
import { isOk } from "typerun/result";import { string } from "typerun/schema";import { validate } from "typerun";const result = validate(string)("hello");if (isOk(result)) { console.log(result.data); // "hello"} else { console.log(result.errors);} Copy
import { isOk } from "typerun/result";import { string } from "typerun/schema";import { validate } from "typerun";const result = validate(string)("hello");if (isOk(result)) { console.log(result.data); // "hello"} else { console.log(result.errors);}
The result to check.
Check if a result is successful.
Example