Why can’t an interface be assigned to Record?

You’ve run across Index signature is missing in type (only on interfaces, not on type alias) #15300

The code will work when you change an interface to a type:

type Foo = {
    foo: number
}

const foo: Foo = { foo: 1 };
const bar: Record<string, unknown> = foo;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)