@@ -6,21 +6,9 @@ import {createElementFromAttrs, createElementFromHTML} from '../../utils/dom.ts'
66import { getIssueColor , getIssueIcon } from '../issue.ts' ;
77import { debounce } from 'perfect-debounce' ;
88import type TextExpanderElement from '@github/text-expander-element' ;
9+ import type { TextExpanderChangeEvent , TextExpanderResult } from '@github/text-expander-element/dist/text-expander-element.d.ts' ;
910
10- type TextExpanderProvideResult = {
11- matched : boolean ,
12- fragment ?: HTMLElement ,
13- }
14-
15- type TextExpanderChangeEvent = Event & {
16- detail ?: {
17- key : string ,
18- text : string ,
19- provide : ( result : TextExpanderProvideResult | Promise < TextExpanderProvideResult > ) => void ,
20- }
21- }
22-
23- async function fetchIssueSuggestions ( key : string , text : string ) : Promise < TextExpanderProvideResult > {
11+ async function fetchIssueSuggestions ( key : string , text : string ) : Promise < TextExpanderResult > {
2412 const issuePathInfo = parseIssueHref ( window . location . href ) ;
2513 if ( ! issuePathInfo . ownerName ) {
2614 const repoOwnerPathInfo = parseRepoOwnerPathInfo ( window . location . pathname ) ;
@@ -59,7 +47,7 @@ export function initTextExpander(expander: TextExpanderElement) {
5947 return keyStart > lineStart ;
6048 } ;
6149
62- const debouncedIssueSuggestions = debounce ( async ( key : string , text : string ) : Promise < TextExpanderProvideResult > => {
50+ const debouncedIssueSuggestions = debounce ( async ( key : string , text : string ) : Promise < TextExpanderResult > => {
6351 // https://github.com/github/text-expander-element/issues/71
6452 // Upstream bug: when using "multiword+promise", TextExpander will get wrong "key" position.
6553 // To reproduce, comment out the "shouldShowIssueSuggestions" check, use the "await sleep" below,
0 commit comments