Suppose I define a type called Param as follows:
type Param = {
field: string;
active: boolean;
}
I then use this type to create a record with keys of type string and values of type Param, like so:
const params: Record<string, Param> = {
foo: { field: 'hello', active: false },
boo: { field: 'world', active: true },
} as const
Why does TypeScript not automatically infer that the keys of params
are 'foo' or 'boo', even with the use of as const
?