From a062a82f066b27eb3df3ccea8cfa41e1ee9e0dae Mon Sep 17 00:00:00 2001 From: xoldyckk Date: Thu, 11 May 2023 15:14:10 +0530 Subject: [PATCH] ts: Migrate setup.js to typescript. Also added global type definition for `get_offset_to_window` helper function. --- tools/test-js-with-node | 2 +- web/src/global.d.ts | 1 + web/src/page_params.ts | 2 ++ web/src/{setup.js => setup.ts} | 0 4 files changed, 4 insertions(+), 1 deletion(-) rename web/src/{setup.js => setup.ts} (100%) diff --git a/tools/test-js-with-node b/tools/test-js-with-node index e0b34191cc..501b0cbbec 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -181,7 +181,7 @@ EXEMPT_FILES = make_set( "web/src/settings_user_groups_legacy.js", "web/src/settings_user_topics.js", "web/src/settings_users.js", - "web/src/setup.js", + "web/src/setup.ts", "web/src/spectators.js", "web/src/spoilers.ts", "web/src/starred_messages_ui.js", diff --git a/web/src/global.d.ts b/web/src/global.d.ts index 43869d8aaf..0e9d20b1ec 100644 --- a/web/src/global.d.ts +++ b/web/src/global.d.ts @@ -15,6 +15,7 @@ type JQueryCaretRange = { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface JQuery { expectOne(): JQuery; + get_offset_to_window(): DOMRect; tab(action?: string): this; // From web/third/bootstrap modal(action?: string): this; // From web/third/bootstrap diff --git a/web/src/page_params.ts b/web/src/page_params.ts index 7836050a08..4aabe185df 100644 --- a/web/src/page_params.ts +++ b/web/src/page_params.ts @@ -16,6 +16,8 @@ export const page_params: { is_moderator: boolean; is_owner: boolean; is_spectator: boolean; + needs_tutorial: boolean; + page_load_time: number; promote_sponsoring_zulip: boolean; realm_add_custom_emoji_policy: number; realm_avatar_changes_disabled: boolean; diff --git a/web/src/setup.js b/web/src/setup.ts similarity index 100% rename from web/src/setup.js rename to web/src/setup.ts