DEV Community

Discussion on: TypeScript Tutorial - Use "as const" to export colors!

Collapse
phytertek profile image
Ryan Lowe

very cool write up! might I suggest adding a sightly more complex (albeit contrived) example such as

const foo= {
one: 'one',
two: 'two',
three: ['three']
} as const

to demonstrate a complex type difference, ie three = a tuple with 'three' vs string[]
rather than just a string enum equivalent