Comment

Comment by iainmerrick

In Typescript at least, if the discriminated union is set up correctly, you just need a single check of the type field. That lets TS narrow the type so it knows whether e.g. `.posts` is present or not.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton