Hello, This is the fourth article of the advanced typescript tutorial series. Today I'll cover small usage of



as const

Imagine you have some colors defined:



const Colors = { cherry : " #F9193F " , mars : " #F19037 " , meteor : " #FFE3C8 " }

When you try to use them somewhere else TypeScript will show you type of the Colors.cherry is string . This is ok if we have 3 colors, but what if we have 50 colors with strange names? We can use new typescript as const or <const> :



const Colors = { cherry : " #F9193F " , mars : " #F19037 " , meteor : " #FFE3C8 " } as const