With TypeScript, use window.location.href
as window.location
is technically an object containing:
Properties
hash
host
hostname
href <--- you need this
pathname (relative to the host)
port
protocol
search
Properties
hash
host
hostname
href <--- you need this
pathname (relative to the host)
port
protocol
search
Setting window.location
will produce a type error, while
window.location.href
is of type string.