const page_number = 3;
window.location.hash = page_number as string; // Error
"Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first." -> You will get this error if you try to typecast number to string. So, first convert it to unknown and then to string.
window.location.hash = (page_number as unknown) as string; // Correct way