27 karma · joined Jun 4, 2021 (5y ago) · 10 submissions
comment 1y ago · link · parent
In case it's useful for anyone, here is a simple plug-in-play TypeScript version:
```
type Ok<T = void> = T extends undefined ? { ok: true; } : { ok: true; val: T; };
type Err<E extends ResultError = ResultError> = { ok: false; err: E; };
type Result<T = void, E = ResultError> = { ok: true; val: T; } | { ok: false; err: E | ResultError; };
class ResultError extends Error { override name = "ResultError" as const; context?: unknown; constructor (message: string, context?: unknown) { super(message); this.context = context; } }
const ok = <T = void>(val?: T): Ok<T> => ({ ok: true, val: val, } as Ok<T>);
const err = (errType: string, context: unknown = {}): Err<ResultError> => ({ err: new ResultError(errType, context), ok: false, });
```
```
const actionTaker = await op().then(ok).catch(err);
if (result.ok) // handle error
else // use result
```
I will be forever grateful to the developer first introduced to this pattern!
comment 1y ago · link · parent
I lived there for the better part of a year and it completely changed my perspective on living in London. More city-life should be like the Barbican.
comment 5y ago · link · parent
The skills we're looking for are: Must Have: Public portfolio of work TypeScript (or good with JavaScript) Experience with building RESTful APIs Experience with SQL databases Experience with Single Page Applications, React or Angular or Vue Good to Have: Angular Express.js PostgreSQL, TypeORM SASS Unit/Integration testing using Jest Bonus: Docker, Google Cloud Platform
10.
Full Stack Remote Software Engineer Co-Founder or Employee Role(stageupp.com ↗)
1 points · by DrakeDeaton · 5y ago · 3 comments