Skip to main content
Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare).
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 109
  • 132

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.

Source

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 

Setting window.location will produce a type error, while window.location.href is of type string.

Source

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

Setting window.location will produce a type error, while window.location.href is of type string.

Source

Source Link
Tigerware
  • 3.7k
  • 3
  • 26
  • 41

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 

Setting window.location will produce a type error, while window.location.href is of type string.

Source