export type ResultOk = { ok: true; result: T }; export type ResultError = { ok: false; error: E }; export type Result = ResultOk | ResultError; export const createResultOk = (data: T): ResultOk => ({ ok: true, result: data, }); export const createResultError = (error: E): ResultError => ({ ok: false, error, });