Currently exploring typescript and enjoying the type checking it provides. I'm curious as to why tsc is unable to detect that lastName is a number in this specific case. Any insights would be appreciated, thank you.
class Student {
constructor(public firstName, public lastName ) {
}
}
interface Person {
firstName : string;
lastName : string;
}
function greeter(person : Person) {
return "hello, " + person
}
var user = new Student("Jane", 123)
console.log('user', user)
console.log('user.lastName is', typeof user.lastName)
console.log(greeter(user))