When i declare a constant string, typescript gives it the literal type
const x = 'X' // x is of 'X' type
so i get the following error
let y: typeof x = 'Y' // error Type '"Y"' is not assignable to type '"X"'
but why when i check it in an if sentence or console.log it i get string?
if (typeof x === 'X') console.log('OK') // types '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"X"' have no overlap
console.log(typeof x) // string
thanks