Hacker News new | ask | show | jobs
by hn_throwaway_99 1198 days ago
Yep, do this all the time. It's also really nice because when you define a type as

    Record<EnumType, any>
then when you are creating an instance of that Record object, it requires a key for all the EnumType values, and will fail if you forgot one. Still possible to do

    Partial<Record<EnumType, any>>
if you want the keys to be only of the EnumType, but don't require all the EnumType values to be used as a key in the Record.