Literal Type, Narrowing, and Const

Literal type #

A literal type sets a single value to a variable’s type. Initially, TypeScript supported only a string. Nowadays, a literal type can be a Boolean, a number, or an enum.

Get hands-on with 1200+ tech skills courses.