浏览代码

Install `@types/lodash-es`

JC Brand 11 月之前
父节点
当前提交
e35ad233e4

+ 16 - 0
package-lock.json

@@ -35,6 +35,7 @@
         "@babel/preset-env": "^7.18.2",
         "@babel/preset-env": "^7.18.2",
         "@converse/headless": "file:src/headless",
         "@converse/headless": "file:src/headless",
         "@types/bootstrap": "^5.2.10",
         "@types/bootstrap": "^5.2.10",
+        "@types/lodash-es": "^4.17.12",
         "@types/webappsec-credential-management": "^0.6.8",
         "@types/webappsec-credential-management": "^0.6.8",
         "@typescript-eslint/eslint-plugin": "^7.12.0",
         "@typescript-eslint/eslint-plugin": "^7.12.0",
         "@typescript-eslint/parser": "^7.12.0",
         "@typescript-eslint/parser": "^7.12.0",
@@ -2468,6 +2469,21 @@
       "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==",
       "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==",
       "dev": true
       "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": {
     "node_modules/@types/markdown-it": {
       "version": "14.1.1",
       "version": "14.1.1",
       "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.1.tgz",
       "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.1.tgz",

+ 1 - 0
package.json

@@ -77,6 +77,7 @@
     "@babel/preset-env": "^7.18.2",
     "@babel/preset-env": "^7.18.2",
     "@converse/headless": "file:src/headless",
     "@converse/headless": "file:src/headless",
     "@types/bootstrap": "^5.2.10",
     "@types/bootstrap": "^5.2.10",
+    "@types/lodash-es": "^4.17.12",
     "@types/webappsec-credential-management": "^0.6.8",
     "@types/webappsec-credential-management": "^0.6.8",
     "@typescript-eslint/eslint-plugin": "^7.12.0",
     "@typescript-eslint/eslint-plugin": "^7.12.0",
     "@typescript-eslint/parser": "^7.12.0",
     "@typescript-eslint/parser": "^7.12.0",

+ 1 - 1
src/headless/types/plugins/muc/muc.d.ts

@@ -28,7 +28,7 @@ declare class MUC extends ChatBox {
         time_sent: string;
         time_sent: string;
         type: string;
         type: string;
     };
     };
-    debouncedRejoin: any;
+    debouncedRejoin: import("lodash").DebouncedFunc<() => Promise<MUC>>;
     isEntered(): boolean;
     isEntered(): boolean;
     /**
     /**
      * Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI)
      * Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI)

+ 1 - 1
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.
  *  message or `undefined` if not applicable.
  */
  */
 export function handleCorrection(model: ChatBox | MUC, attrs: object): Promise<Message | void>;
 export function handleCorrection(model: ChatBox | MUC, attrs: object): Promise<Message | void>;
-export const debouncedPruneHistory: any;
+export const debouncedPruneHistory: import("lodash").DebouncedFunc<typeof pruneHistory>;
 export type Message = import('../../plugins/chat/message.js').default;
 export type Message = import('../../plugins/chat/message.js').default;
 export type ChatBox = import('../../plugins/chat/model.js').default;
 export type ChatBox = import('../../plugins/chat/model.js').default;
 export type MUC = import('../../plugins/muc/muc.js').default;
 export type MUC = import('../../plugins/muc/muc.js').default;

+ 1 - 1
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 {
 export class Connection extends Connection_base {
     constructor(service: any, options: any);
     constructor(service: any, options: any);
     send_initial_presence: boolean;
     send_initial_presence: boolean;
-    debouncedReconnect: any;
+    debouncedReconnect: import("lodash").DebouncedFunc<() => Promise<any>>;
     /** @param {Element} body */
     /** @param {Element} body */
     xmlInput(body: Element): void;
     xmlInput(body: Element): void;
     bind(): Promise<void>;
     bind(): Promise<void>;

+ 2 - 2
src/headless/types/shared/rsm.d.ts

@@ -13,7 +13,7 @@ export const RSM_ATTRIBUTES: string[];
  * @class RSM
  * @class RSM
  */
  */
 export class RSM {
 export class RSM {
-    static getQueryParameters(options?: {}): any;
+    static getQueryParameters(options?: {}): Partial<{}>;
     static parseXMLResult(set: any): {
     static parseXMLResult(set: any): {
         index: number;
         index: number;
     };
     };
@@ -23,7 +23,7 @@ export class RSM {
      * @constructor
      * @constructor
      */
      */
     constructor(options?: any);
     constructor(options?: any);
-    query: any;
+    query: Partial<{}>;
     result: {};
     result: {};
     /**
     /**
      * Returns a `<set>` XML element that confirms to XEP-0059 Result Set Management.
      * Returns a `<set>` XML element that confirms to XEP-0059 Result Set Management.

+ 2 - 2
src/shared/chat/emoji-picker.js

@@ -216,8 +216,8 @@ export default class EmojiPicker extends CustomElement {
      * @param {KeyboardEvent} ev
      * @param {KeyboardEvent} ev
      */
      */
     onSearchInputKeyDown (ev) {
     onSearchInputKeyDown (ev) {
+        const target = /** @type {HTMLInputElement} */(ev.target);
         if (ev.keyCode === KEYCODES.TAB) {
         if (ev.keyCode === KEYCODES.TAB) {
-            const target = /** @type {HTMLInputElement} */(ev.target);
             if (target.value) {
             if (target.value) {
                 ev.preventDefault();
                 ev.preventDefault();
                 const match = converse.emojis.shortnames.find(sn => FILTER_CONTAINS(sn, target.value));
                 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.ENTER &&
             ev.keyCode !== KEYCODES.DOWN_ARROW
             ev.keyCode !== KEYCODES.DOWN_ARROW
         ) {
         ) {
-            this.debouncedFilter(ev.target);
+            this.debouncedFilter(target);
         }
         }
     }
     }
 
 

+ 1 - 1
src/types/plugins/bookmark-views/components/bookmarks-list.d.ts

@@ -1,6 +1,6 @@
 export default class BookmarksView extends CustomElement {
 export default class BookmarksView extends CustomElement {
     initialize(): Promise<void>;
     initialize(): Promise<void>;
-    liveFilter: any;
+    liveFilter: import("lodash").DebouncedFunc<(ev: any) => false | Model>;
     model: Model;
     model: Model;
     render(): import("lit").TemplateResult<1>;
     render(): import("lit").TemplateResult<1>;
     clearFilter(ev: any): void;
     clearFilter(ev: any): void;

+ 4 - 1
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
      * to use a pre-key, which it chooses randomly from the list of available
      * ones.
      * ones.
      */
      */
-    generatePreKeys(): Promise<any>;
+    generatePreKeys(): Promise<{
+        id: any;
+        key: any;
+    }[]>;
     /**
     /**
      * Generate the cryptographic data used by the X3DH key agreement protocol
      * Generate the cryptographic data used by the X3DH key agreement protocol
      * in order to build a session with other devices.
      * in order to build a session with other devices.

+ 1 - 1
src/types/shared/chat/emoji-picker.d.ts

@@ -28,7 +28,7 @@ export default class EmojiPicker extends CustomElement {
     model: any;
     model: any;
     query: string;
     query: string;
     _search_results: any[];
     _search_results: any[];
-    debouncedFilter: any;
+    debouncedFilter: import("lodash").DebouncedFunc<(input: HTMLInputElement) => any>;
     set search_results(arg: any[]);
     set search_results(arg: any[]);
     get search_results(): any[];
     get search_results(): any[];
     render(): import("lit").TemplateResult<1>;
     render(): import("lit").TemplateResult<1>;

+ 1 - 1
src/types/shared/chat/utils.d.ts

@@ -58,7 +58,7 @@ export function shortnamesToEmojis(str: string, options?: {
     unicode_only: boolean;
     unicode_only: boolean;
     add_title_wrapper: boolean;
     add_title_wrapper: boolean;
 }): any[];
 }): any[];
-export const markScrolled: any;
+export const markScrolled: import("lodash").DebouncedFunc<(ev: any) => void>;
 export type EmojiMarkupOptions = {
 export type EmojiMarkupOptions = {
     unicode_only?: boolean;
     unicode_only?: boolean;
     add_title_wrapper?: boolean;
     add_title_wrapper?: boolean;

+ 1 - 1
src/types/shared/components/list-filter.d.ts

@@ -21,7 +21,7 @@ export default class ListFilter extends CustomElement {
     template: any;
     template: any;
     promise: Promise<void>;
     promise: Promise<void>;
     initialize(): void;
     initialize(): void;
-    liveFilter: any;
+    liveFilter: import("lodash").DebouncedFunc<(ev: any) => any>;
     render(): any;
     render(): any;
     dispatchUpdateEvent(): void;
     dispatchUpdateEvent(): void;
     /**
     /**