Chromeの実験プロパティを上書きする必要があり、このエラーが発生します。
if ('scrollRestoration' in history) {
history.scrollRestoration = 'manual'; // type error
}
私は答えを見つけました: http :
(history as any).scrollRestoration = 'manual';
vs
history['scrollRestoration'] = 'manual';
TypeScriptのドキュメント/詳細な本は角括弧の構文について言及していないようです。
最も参考になるコメント
私は最初のもので行きます。 2つ目は機能しますが、
-noImplicitAny
なしでコンパイルする場合に限ります。