All posts

TypeScript for Frontend: 5 Tips That Make Daily Life Easier

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]
0

Comments 0

No comments yet. Be the first to comment!