Open
Description
TypeScript Version: 3.3
Code
type Record2<K extends keyof any, T> = {
[P in K]: T;
};
function defaultRecord(x: Record<'a', string>, y: Record<string, string>) {
x = y; // no error, but error expected.
}
function customRecord(x: Record2<'a', string>, y: Record2<string, string>) {
x = y; // no error, but error expected.
}
function mixed1(x: Record2<'a', string>, y: Record<string, string>) {
x = y; // error
}
function mixed2(x: Record<'a', string>, y: Record2<string, string>) {
x = y; // error
}
Playground Link: link
Related Issues: #28798