Need Assistance?

support@tutorialshub.in

Unions, Literals & Type Narrowing

Literal Types & as const

ADVERTISEMENT
TypeScript Free Lesson
5 min read
ADVERTISEMENT

Instead of accepting any string, Literal Types restrict a variable to exact allowed values—like 'GET' | 'POST'. Appending as const to an array or object freezes all values to their narrowest literal types.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you