Comment

Comment by valand

Guaranteed almost 100% type soundness!!! Non TypeScript user will hate this.

Config it to maximum strictness!

Add in runtime type checks Parse, don't validate https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

Bring type to business logic, e.g.

RegisteredUser { userId: number, email: string }

AnonymousUser { userId: number, email: null }

User = RegisteredUser | AnonymousUser

Handle errors ala Rust,

Return errors/errortype rather than throws

Utilize structure to determine result, e.g.

Failure { error: Error, value: null }

Success<T> { error: null, value: T }

It is worth it. My experience with TypeScript is a whole lot different.

Conspiracy theory inducing facts:

- LogRocket's main use is monitoring bugs in browser application

- Airbnb is LogRocket's customer

parent valand 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton