Comment

Comment by dolia

"every time I have to type "as" my inner Haskell programmer screams." - most of the times you don't have to. You choose to.

"If I could add one feature to Typescript it would be something like "as" that actually validates the result against the type system and can fail." - I don't think it's fair to expect that since most of the statically typed languages will not guarantee things in runtime unless you specifically run a validation code in runtime.

There's also type guards and good old self-written validation functions you can use.

parent dolia 4 months ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton