Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ts: Convert `compose_textarea.js` to TypeScript.
Lalit38dd1de5b23e
diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex a7e45e8125a..05cf5405d77 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -67,7 +67,7 @@ EXEMPT_FILES = make_set("web/src/compose_fade.js","web/src/compose_recipient.js","web/src/compose_state.js",- "web/src/compose_textarea.js",+ "web/src/compose_textarea.ts","web/src/compose_ui.js","web/src/compose_validate.js","web/src/composebox_typeahead.js",diff --git a/web/src/compose_textarea.js b/web/src/compose_textarea.tssimilarity index 83%rename from web/src/compose_textarea.jsrename to web/src/compose_textarea.tsindex f89c2fcfd8c..6b33641f080 100644--- a/web/src/compose_textarea.js+++ b/web/src/compose_textarea.ts@@ -4,7 +4,7 @@ import $ from "jquery";// shift-tab back in (see hotkey.js).let saved_compose_cursor = 0;-function set_compose_textarea_handlers() {+function set_compose_textarea_handlers(): void {$("#compose-textarea").on("blur", function () {saved_compose_cursor = $(this).caret();});@@ -16,10 +16,10 @@ function set_compose_textarea_handlers() {});}-export function restore_compose_cursor() {+export function restore_compose_cursor(): void {$("#compose-textarea").trigger("focus").caret(saved_compose_cursor);}-export function initialize() {+export function initialize(): void {set_compose_textarea_handlers();}diff --git a/web/src/global.d.ts b/web/src/global.d.tsindex 7e38aacdf6d..fb57733d30e 100644--- a/web/src/global.d.ts+++ b/web/src/global.d.ts@@ -5,10 +5,26 @@declare let zulip_test: any; // eslint-disable-line @typescript-eslint/no-explicit-any+type JQueryCaretRange = {+ start: number;+ end: number;+ length: number;+ text: string;+};+// eslint-disable-next-line @typescript-eslint/consistent-type-definitionsinterface JQuery {expectOne(): JQuery;tab(action?: string): this; // From web/third/bootstrap++ // Types for jquery-caret-plugin+ caret(): number;+ caret(arg: number | string): this;+ range(): JQueryCaretRange;+ range(start: number, end?: number): this;+ range(text: string): this;+ selectAll(): this;+ deselectAll(): this;}declare const ZULIP_VERSION: string;