microsoft / microsoft/TypeScript
Assigning window.location after 5.8.2 upgrade fails
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- PR merge metrics
- PR metrics pending
Description
### 🔎 Search Terms
Unable to assign window.location typescript 5.8.2
error TS2322: Type 'Location' is not assignable to type 'string & Location'.
Type 'Location' is not assignable to type 'string'.
### 🕗 Version & Regression Information
- This changed between versions 5.7.3 and 5.8.2
### ⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.8.2#code/O4SwdgJg9sB0A2UDGBDALiKYAEBebokMCy6mYA3AFBA
### 💻 Code
```ts
window.location = window.location;
```
### 🙁 Actual behavior
Failing with error:
```
error TS2322: Type 'Location' is not assignable to type 'string & Location'.
Type 'Location' is not assignable to type 'string'.
```
### 🙂 Expected behavior
Expect it to either be a documented breaking change, OR it should continue to work as it did in 5.7.3:
https://www.typescriptlang.org/play/?ts=5.7.3#code/O4SwdgJg9sB0A2UDGBDALiKYAEBebokMCy6mYA3AFBA
### Additional information about the issue
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.