I like the tricks :) – Kasia
Avoid enumerating all the values of a union type manually.
type Check = 'Avionics' | 'Recovery' | 'Navigation' const checklist: Check[] = ['Avionics', 'Recovery'] // ⛔️ Forgot 'Navigation'
const checklist = // ✅ Single point of truth ['Avionics', 'Recovery', 'Navigation'] as const type Checklist = (typeof checklist) // ^? type Checklist = readonly ['Avionics', 'Recovery', 'Navigation'] type Check = Checklist[number] // ^? type Check = 'Avionics' | 'Recovery' | 'Navigation'
Crafted with 💛 by Riccardo