I have a variable and three function:
const a: string | number = 3
function b(){
console.log(a) // string | number
}
const c = function (){
console.log(a) // number
}
const d = () => {
console.log(a) // number
}
When I hovered the word a in function b, what I got is string | number;
When I hovered the word a in function c, what I got is number;
When I hovered the word a in function d, what I got is number
But isn't a a constant? After the first time it was assigned the value 3, a have been infered to become a number type. Why in function b it still have a chance to become a string type?