From c118d66943c04eed3f3961da431f0dac5b8f4d88 Mon Sep 17 00:00:00 2001 From: evykassirer Date: Sat, 30 Mar 2024 15:04:55 -0700 Subject: [PATCH] typeahead: Rename input element type to be more specific. This will be exported in an upcoming commit and a more specific name will make more sense when using this type in other files. --- web/src/bootstrap_typeahead.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web/src/bootstrap_typeahead.ts b/web/src/bootstrap_typeahead.ts index 04e68eaad1..2c38ba09f8 100644 --- a/web/src/bootstrap_typeahead.ts +++ b/web/src/bootstrap_typeahead.ts @@ -178,7 +178,7 @@ const MENU_HTML = ''; const ITEM_HTML = "
  • "; const MIN_LENGTH = 1; -type InputElement = +type TypeaheadInputElement = | { $element: JQuery; type: "contenteditable"; @@ -189,7 +189,7 @@ type InputElement = }; class Typeahead { - input_element: InputElement; + input_element: TypeaheadInputElement; items: number; matcher: (item: ItemType, query: string) => boolean; sorter: (items: ItemType[], query: string) => ItemType[]; @@ -197,13 +197,13 @@ class Typeahead { updater: ( item: ItemType, query: string, - input_element: InputElement, + input_element: TypeaheadInputElement, event?: JQuery.ClickEvent | JQuery.KeyUpEvent | JQuery.KeyDownEvent, ) => string | undefined; $container: JQuery; $menu: JQuery; $header: JQuery; - source: (query: string, input_element: InputElement) => ItemType[]; + source: (query: string, input_element: TypeaheadInputElement) => ItemType[]; dropup: boolean; fixed: boolean; automated: () => boolean; @@ -226,7 +226,7 @@ class Typeahead { advanceKeyCodes: number[]; parentElement?: string; - constructor(input_element: InputElement, options: TypeaheadOptions) { + constructor(input_element: TypeaheadInputElement, options: TypeaheadOptions) { this.input_element = input_element; if (this.input_element.type === "contenteditable") { assert(this.input_element.$element.is("[contenteditable]")); @@ -694,7 +694,7 @@ class Typeahead { type TypeaheadOptions = { highlighter_html: (item: ItemType, query: string) => string | undefined; items: number; - source: (query: string, input_element: InputElement) => ItemType[]; + source: (query: string, input_element: TypeaheadInputElement) => ItemType[]; // optional options advanceKeyCodes?: number[]; automated?: () => boolean; @@ -716,13 +716,13 @@ type TypeaheadOptions = { updater: ( item: ItemType, query: string, - input_element: InputElement, + input_element: TypeaheadInputElement, event?: JQuery.ClickEvent | JQuery.KeyUpEvent | JQuery.KeyDownEvent, ) => string | undefined; }; export function create( - input_element: InputElement, + input_element: TypeaheadInputElement, options: TypeaheadOptions, ): void { input_element.$element.data("typeahead", new Typeahead(input_element, options));