Hacker News new | ask | show | jobs
by hombre_fatal 443 days ago
I don’t get the problem with null values as long as you can statically reason about them which wasn’t even the case in Java where you had to always do runtime null-guards before access.

But in Typescript, who cares? You’d be forced to handle null the same way you’d be forced to handle Maybe<T> = None | Just<T> except with extra, unidiomatic ceremony in the latter case.

1 comments

What you mean with unidiomatic? If a language has

    Maybe<T> = None | Just<T>
as a core concept then it's idiomatic by definition.
Typescript doesn't define a Maybe<T> nor do you need it to have idiomatic statically-typed nullability.

It already has:

type value = string | null