Have a look at this example typescript code
function printLabel(labelledObj: { label: string }) {
console.log(labelledObj.label);
}
printLabel({ size: 1
It's by design. In short, Typescript creators made it this way because they know Javascript is a very dynamic language with many such use cases.
You should read this carefully: https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks (however I bet the question arised from reading it).
Object literals get special treatment
Their logic might be like this: if you have a variable, then it may come from some third party and there is not much you can do with it. On the other hand, if you pass object literal, then you are responsible for its correct type.