Misc typescript tweaks (#36523)

Some minor refactors, disable one obsolete lint rule, fix another. The
tribute type issue is not fully fixed and I'm pretty sure it must be an
error in their types.
This commit is contained in:
silverwind
2026-02-10 06:09:56 +01:00
committed by GitHub
parent 8cc8150922
commit 09a88fb17e
6 changed files with 18 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
import {emojiKeys, emojiHTML, emojiString} from './emoji.ts';
import {html, htmlRaw} from '../utils/html.ts';
import type {TributeCollection} from 'tributejs';
import type {MentionValue} from '../types.ts';
export async function attachTribute(element: HTMLElement) {
const {default: Tribute} = await import(/* webpackChunkName: "tribute" */'tributejs');
@@ -28,7 +29,7 @@ export async function attachTribute(element: HTMLElement) {
},
};
const mentionCollection: TributeCollection<Record<string, any>> = {
const mentionCollection: TributeCollection<MentionValue> = {
values: window.config.mentionValues,
requireLeadingSpace: true,
menuItemTemplate: (item) => {
@@ -44,7 +45,10 @@ export async function attachTribute(element: HTMLElement) {
};
const tribute = new Tribute({
collection: [emojiCollection as TributeCollection<any>, mentionCollection],
collection: [
emojiCollection as TributeCollection<any>,
mentionCollection as TributeCollection<any>,
],
noMatchTemplate: () => '',
});
tribute.attach(element);