From e35ad233e4445b5b39208b8195b8e2ee875063ad Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 1 Aug 2024 09:52:24 +0200 Subject: [PATCH] Install `@types/lodash-es` --- package-lock.json | 16 ++++++++++++++++ package.json | 1 + src/headless/types/plugins/muc/muc.d.ts | 2 +- src/headless/types/shared/chat/utils.d.ts | 2 +- src/headless/types/shared/connection/index.d.ts | 2 +- src/headless/types/shared/rsm.d.ts | 4 ++-- src/shared/chat/emoji-picker.js | 4 ++-- .../components/bookmarks-list.d.ts | 2 +- src/types/plugins/omemo/store.d.ts | 5 ++++- src/types/shared/chat/emoji-picker.d.ts | 2 +- src/types/shared/chat/utils.d.ts | 2 +- src/types/shared/components/list-filter.d.ts | 2 +- 12 files changed, 32 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index b63efe4b14..ac7e1e295b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,7 @@ "@babel/preset-env": "^7.18.2", "@converse/headless": "file:src/headless", "@types/bootstrap": "^5.2.10", + "@types/lodash-es": "^4.17.12", "@types/webappsec-credential-management": "^0.6.8", "@typescript-eslint/eslint-plugin": "^7.12.0", "@typescript-eslint/parser": "^7.12.0", @@ -2468,6 +2469,21 @@ "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", "dev": true }, + "node_modules/@types/lodash": { + "version": "4.17.7", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz", + "integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==", + "dev": true + }, + "node_modules/@types/lodash-es": { + "version": "4.17.12", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz", + "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", + "dev": true, + "dependencies": { + "@types/lodash": "*" + } + }, "node_modules/@types/markdown-it": { "version": "14.1.1", "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.1.tgz", diff --git a/package.json b/package.json index 596c98c9ed..f12ae503e9 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,7 @@ "@babel/preset-env": "^7.18.2", "@converse/headless": "file:src/headless", "@types/bootstrap": "^5.2.10", + "@types/lodash-es": "^4.17.12", "@types/webappsec-credential-management": "^0.6.8", "@typescript-eslint/eslint-plugin": "^7.12.0", "@typescript-eslint/parser": "^7.12.0", diff --git a/src/headless/types/plugins/muc/muc.d.ts b/src/headless/types/plugins/muc/muc.d.ts index 4c8fbc5f46..30a41beecd 100644 --- a/src/headless/types/plugins/muc/muc.d.ts +++ b/src/headless/types/plugins/muc/muc.d.ts @@ -28,7 +28,7 @@ declare class MUC extends ChatBox { time_sent: string; type: string; }; - debouncedRejoin: any; + debouncedRejoin: import("lodash").DebouncedFunc<() => Promise>; isEntered(): boolean; /** * Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI) diff --git a/src/headless/types/shared/chat/utils.d.ts b/src/headless/types/shared/chat/utils.d.ts index a2559be4c3..de27b528ac 100644 --- a/src/headless/types/shared/chat/utils.d.ts +++ b/src/headless/types/shared/chat/utils.d.ts @@ -14,7 +14,7 @@ export function pruneHistory(model: ChatBox | MUC): void; * message or `undefined` if not applicable. */ export function handleCorrection(model: ChatBox | MUC, attrs: object): Promise; -export const debouncedPruneHistory: any; +export const debouncedPruneHistory: import("lodash").DebouncedFunc; export type Message = import('../../plugins/chat/message.js').default; export type ChatBox = import('../../plugins/chat/model.js').default; export type MUC = import('../../plugins/muc/muc.js').default; diff --git a/src/headless/types/shared/connection/index.d.ts b/src/headless/types/shared/connection/index.d.ts index 7e0424d57c..f2563290c5 100644 --- a/src/headless/types/shared/connection/index.d.ts +++ b/src/headless/types/shared/connection/index.d.ts @@ -7,7 +7,7 @@ declare const Connection_base: typeof import("strophe.js/src/types/connection.js export class Connection extends Connection_base { constructor(service: any, options: any); send_initial_presence: boolean; - debouncedReconnect: any; + debouncedReconnect: import("lodash").DebouncedFunc<() => Promise>; /** @param {Element} body */ xmlInput(body: Element): void; bind(): Promise; diff --git a/src/headless/types/shared/rsm.d.ts b/src/headless/types/shared/rsm.d.ts index 593b922201..71bc2d19ee 100644 --- a/src/headless/types/shared/rsm.d.ts +++ b/src/headless/types/shared/rsm.d.ts @@ -13,7 +13,7 @@ export const RSM_ATTRIBUTES: string[]; * @class RSM */ export class RSM { - static getQueryParameters(options?: {}): any; + static getQueryParameters(options?: {}): Partial<{}>; static parseXMLResult(set: any): { index: number; }; @@ -23,7 +23,7 @@ export class RSM { * @constructor */ constructor(options?: any); - query: any; + query: Partial<{}>; result: {}; /** * Returns a `` XML element that confirms to XEP-0059 Result Set Management. diff --git a/src/shared/chat/emoji-picker.js b/src/shared/chat/emoji-picker.js index 627143f501..298818d72b 100644 --- a/src/shared/chat/emoji-picker.js +++ b/src/shared/chat/emoji-picker.js @@ -216,8 +216,8 @@ export default class EmojiPicker extends CustomElement { * @param {KeyboardEvent} ev */ onSearchInputKeyDown (ev) { + const target = /** @type {HTMLInputElement} */(ev.target); if (ev.keyCode === KEYCODES.TAB) { - const target = /** @type {HTMLInputElement} */(ev.target); if (target.value) { ev.preventDefault(); const match = converse.emojis.shortnames.find(sn => FILTER_CONTAINS(sn, target.value)); @@ -231,7 +231,7 @@ export default class EmojiPicker extends CustomElement { ev.keyCode !== KEYCODES.ENTER && ev.keyCode !== KEYCODES.DOWN_ARROW ) { - this.debouncedFilter(ev.target); + this.debouncedFilter(target); } } diff --git a/src/types/plugins/bookmark-views/components/bookmarks-list.d.ts b/src/types/plugins/bookmark-views/components/bookmarks-list.d.ts index 661361e461..fc21866130 100644 --- a/src/types/plugins/bookmark-views/components/bookmarks-list.d.ts +++ b/src/types/plugins/bookmark-views/components/bookmarks-list.d.ts @@ -1,6 +1,6 @@ export default class BookmarksView extends CustomElement { initialize(): Promise; - liveFilter: any; + liveFilter: import("lodash").DebouncedFunc<(ev: any) => false | Model>; model: Model; render(): import("lit").TemplateResult<1>; clearFilter(ev: any): void; diff --git a/src/types/plugins/omemo/store.d.ts b/src/types/plugins/omemo/store.d.ts index 6a0d748463..5716a6f887 100644 --- a/src/types/plugins/omemo/store.d.ts +++ b/src/types/plugins/omemo/store.d.ts @@ -42,7 +42,10 @@ declare class OMEMOStore extends Model { * to use a pre-key, which it chooses randomly from the list of available * ones. */ - generatePreKeys(): Promise; + generatePreKeys(): Promise<{ + id: any; + key: any; + }[]>; /** * Generate the cryptographic data used by the X3DH key agreement protocol * in order to build a session with other devices. diff --git a/src/types/shared/chat/emoji-picker.d.ts b/src/types/shared/chat/emoji-picker.d.ts index ef0e55b7be..f706eb6ce1 100644 --- a/src/types/shared/chat/emoji-picker.d.ts +++ b/src/types/shared/chat/emoji-picker.d.ts @@ -28,7 +28,7 @@ export default class EmojiPicker extends CustomElement { model: any; query: string; _search_results: any[]; - debouncedFilter: any; + debouncedFilter: import("lodash").DebouncedFunc<(input: HTMLInputElement) => any>; set search_results(arg: any[]); get search_results(): any[]; render(): import("lit").TemplateResult<1>; diff --git a/src/types/shared/chat/utils.d.ts b/src/types/shared/chat/utils.d.ts index d42d2b5cf4..8198be4760 100644 --- a/src/types/shared/chat/utils.d.ts +++ b/src/types/shared/chat/utils.d.ts @@ -58,7 +58,7 @@ export function shortnamesToEmojis(str: string, options?: { unicode_only: boolean; add_title_wrapper: boolean; }): any[]; -export const markScrolled: any; +export const markScrolled: import("lodash").DebouncedFunc<(ev: any) => void>; export type EmojiMarkupOptions = { unicode_only?: boolean; add_title_wrapper?: boolean; diff --git a/src/types/shared/components/list-filter.d.ts b/src/types/shared/components/list-filter.d.ts index e947de0c49..e46aac12ce 100644 --- a/src/types/shared/components/list-filter.d.ts +++ b/src/types/shared/components/list-filter.d.ts @@ -21,7 +21,7 @@ export default class ListFilter extends CustomElement { template: any; promise: Promise; initialize(): void; - liveFilter: any; + liveFilter: import("lodash").DebouncedFunc<(ev: any) => any>; render(): any; dispatchUpdateEvent(): void; /**