I use TypeScript not to "type everything" but to "catch bugs early".
1. Literal types with as const
const STATUSES = ['idle', 'loading', 'done'] as const
type Status = (typeof STATUSES)[number]I use TypeScript not to "type everything" but to "catch bugs early".
const STATUSES = ['idle', 'loading', 'done'] as const
type Status = (typeof STATUSES)[number]No comments yet. Be the first to comment!