Tag

F#

2 stories

Not just a headline — the discussion unpacked

The top HN threads: facts from the discussions, both sides, insider voices. Email, Telegram, or RSS.

'Parse, don't validate' in a language that fights you: TypeScript's structural typing problem (cekrem.github.io)

An essay walks through making 'parse, don't validate' work in TypeScript, where structural typing means a validated Email is indistinguishable from any string. The fix is a branded type: a phantom symbol that makes Email incompatible with string at compile time and vanishes at runtime.

The thread's senior voices split on whether that's the real idea or a fake-out: one argued branding just labels a string as 'validated,' while another countered that all type guarantees are ultimately validation the compiler agrees to trust.