refactor(platform-browser): cast response of JSON.parse (#41020)

Casts the response of JSON.parse to `{}`, so that is not an `any` type.
This is because google3 does not allow the use of `any` type.

PR Close #41020
This commit is contained in:
Zach Arend 2021-02-26 10:19:00 -08:00
parent 198e841564
commit 3370ade9a4
1 changed files with 2 additions and 1 deletions

View File

@ -150,7 +150,8 @@ export function initTransferState(doc: Document, appId: string) {
let initialState = {};
if (script && script.textContent) {
try {
initialState = JSON.parse(unescapeHtml(script.textContent));
// Avoid using any here as it triggers lint errors in google3 (any is not allowed).
initialState = JSON.parse(unescapeHtml(script.textContent)) as {};
} catch (e) {
console.warn('Exception while restoring TransferState for app ' + appId, e);
}