In Typescript, interfaces are considered to be "open", allowing for additional properties to exist on an object that are not defined within its interface. Surprisingly, this does not result in a compile-time error.
As a result, an object of type {a: string}
can be assigned as a valid value for Record<symbol, unknown>
.
To demonstrate this flexibility, you can use the following code snippet which will compile without any issues:
const exampleObj: {a: string} = {a: "bar"};
const recordExample: Record<symbol, unknown> = exampleObj;