B
B
BonBon Slick2020-05-12 20:42:45
typescript
BonBon Slick, 2020-05-12 20:42:45

TS2322: Type '"about:blank"' is not assignable to type 'Location'.?

window.location = 'about:blank';

Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-05-15
@BonBonSlick

Because in typescript, a specific property must have a specific type, and no one bothered with complex typing of legacy functionality. Use window.location.href = ....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question