Why does the code snippet below not result in a type error being thrown?
const fn1 = (arg1: { key: number }) => {
console.log(arg1);
}
// This call works as expected
fn1({ key: 1 });
// However, this call does not produce a type error
fn1({ key: 1, a: 1 });
- Reference: Check it out here
I've spent some time going through the TypeScript documentation and searching on Google but I'm still puzzled by this behavior!