total-typescript / ts-reset

A 'CSS reset' for TypeScript, improving types for common JavaScript API's

Home Page:https://www.totaltypescript.com/ts-reset

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set default Record types to string

KonkenBonken opened this issue · comments

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>

Don't think we can make this work, given that Record is specified with a type and ts-reset works via declaration merging.