Set default Record types to string
KonkenBonken opened this issue · comments
Konrad Pettersson commented
When using the the TypeScript Record
utility type, the vast majority of times, at least in my experience, the key is of type string
.
So why is it not the default?
I propose that string
should be the default type for both parameters,
and when only one argument is provided, is should be the type of the value,
My proposition | Current behavior |
---|---|
Record<> |
Record<string, string> |
Record<Animal> |
Record<string, Animal> |
Record<number, Animal> |
Record<number, Animal> |
Matt Pocock commented
Don't think we can make this work, given that Record is specified with a type and ts-reset works via declaration merging.