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
| import { err, isErr, ok } from "./result"; | |
| function createError<const T extends readonly string[]>(_codes: T) { | |
| type Code = T[number]; | |
| class AppError<C extends Code = Code> extends Error { | |
| public readonly code: C; | |
| constructor(code: C) { | |
| super(`Error: ${code}`); |
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
| import type { Thunk, UnaryFn } from "./func" | |
| import { type Result, err, isErr, ok } from "./result" | |
| export type AsyncResult<E, T> = Promise<Result<E, T>> | |
| export const fromResult = <E, T>(result: Result<E, T>): AsyncResult<E, T> => | |
| Promise.resolve(result) | |
| export const fromThrowable = async <E, T>( | |
| f: Thunk<Promise<T>>, |
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
| # just because I always forget | |
| git submodule update --init --recursive |