From aa2c55538fd672f34babdcf40eb2f9365e8baf42 Mon Sep 17 00:00:00 2001 From: Priyank Patel Date: Wed, 19 Jun 2019 20:59:43 -0400 Subject: [PATCH] typescript: Migrate params-util.js to typescript. --- .../js/utils/{params-util.js => params-util.ts} | 10 +++------- typings.d.ts | 2 ++ 2 files changed, 5 insertions(+), 7 deletions(-) rename app/renderer/js/utils/{params-util.js => params-util.ts} (60%) diff --git a/app/renderer/js/utils/params-util.js b/app/renderer/js/utils/params-util.ts similarity index 60% rename from app/renderer/js/utils/params-util.js rename to app/renderer/js/utils/params-util.ts index 610981a4..4ce87809 100644 --- a/app/renderer/js/utils/params-util.js +++ b/app/renderer/js/utils/params-util.ts @@ -1,15 +1,11 @@ // This util function returns the page params if they're present else returns null -function isPageParams() { +export function isPageParams(): null | object { let webpageParams = null; try { - // eslint-disable-next-line no-undef, camelcase + // eslint-disable-next-line no-undef, @typescript-eslint/camelcase webpageParams = page_params; - } catch (err) { + } catch (_) { webpageParams = null; } return webpageParams; } - -module.exports = { - isPageParams -}; diff --git a/typings.d.ts b/typings.d.ts index a2612129..797d7697 100644 --- a/typings.d.ts +++ b/typings.d.ts @@ -4,5 +4,7 @@ // are not supported declare module '*'; +declare var page_params: object; + // since requestIdleCallback didn't make it into lib.dom.d.ts yet declare function requestIdleCallback(callback: Function, options?: object): void;