type B<U> = {
key: string
} & Record<string, U>
const example: B<boolean> = {
key: '123',
testKey: false
}
// Error: TS2322: Type { key: string; testKey: boolean; } is not assignable to type B Type { key: string; testKey: boolean; } is not assignable to type Record<string, boolean> Property key is incompatible with index signature. Type string is not assignable to type boolean
What causes this error and how can a type be defined with one value as a string and the rest as specified?