This repository has been archived on 2026-03-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

20 lines
334 B
TypeScript

export class TypeError extends Error {
constructor(message: string) {
super(message);
this.name = this.constructor.name;
}
}
export class Err<_> {
message: string;
constructor(str: string) {
this.message = str;
}
toError() {
return new TypeError(this.message);
}
}
export type Result<T> = T | Err<T>;