Is it possible to receive an error message from the function in the following example? I have included comments at a relevant spot in the code below:
interface Pos {
x: number,
y: number,
}
function doSome(pos: Pos) {
return pos.x + pos.y
}
let pos = {
x: 1,
y: 2,
z: 3,
}
// How can we trigger an error message from this function?
// The 'pos' object contains property 'z', which
// is not part of the 'Pos' interface.
// We aim to enforce strict typing by ensuring that
// the variable 'pos' aligns with the 'Pos' interface.
let p = doSome(pos)