How can get a error message from the function in the example below? I have made comments in the relevant place 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,
}
// I want this function to give me an error
// message as 'pos' does contain 'z' which
// the interface 'Pos' does not.
// The variable 'pos' is not exactly the same
// type as the interface 'Pos', which i want
// to make sure it is in this case.
let p = doSome(pos)