Hacker News new | ask | show | jobs
by braebo 480 days ago
If all you need is a union type then the latter is plenty.

If you need the actual strings to iterate over or validate against, deriving the value from an const array is helpful:

  const THINGS = ['one', 'two', 'three'] as const

  type Thing = THINGS[number]