There are times when using as const
at the end of an object declaration can be incredibly helpful, as it creates a literal singleton type. However, the drawback is that you lose the ability to specify a type without sacrificing the specific keys as shown in the example below.
https://i.sstatic.net/1uwKZ.png
It would be beneficial to maintain the static values of literal keys while still performing type checking.
Is there a method to preserve the keys as specific literals, while verifying the required general type?