From 3370ade9a4873919c0797c04ac84b2c18f357c13 Mon Sep 17 00:00:00 2001 From: Zach Arend Date: Fri, 26 Feb 2021 10:19:00 -0800 Subject: [PATCH] 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 --- packages/platform-browser/src/browser/transfer_state.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/platform-browser/src/browser/transfer_state.ts b/packages/platform-browser/src/browser/transfer_state.ts index b7bafd6d4f..a4384f44b6 100644 --- a/packages/platform-browser/src/browser/transfer_state.ts +++ b/packages/platform-browser/src/browser/transfer_state.ts @@ -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); }