chore(deps): update lint (#2233)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
This commit is contained in:
renovate[bot] 2023-08-02 10:28:18 +00:00 committed by GitHub
parent 603e10b6ca
commit 67d5d5c00a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 349 additions and 270 deletions

View file

@ -52,6 +52,9 @@ export type ResolvedCommand = Exclude<CommandProvider, 'icon' | 'name' | 'descri
bindings: string[] | undefined
}
// TODO: define a type for command arg
export type CommandHandler<T = void> = (arg: T) => void
export interface BaseQueryResultItem {
index: number
type: string
@ -78,7 +81,7 @@ export interface QueryResult {
grouped: Map<CommandScopeNames, QueryResultItem[]>
}
function r<T extends Object | undefined>(i: T | (() => T)): T {
function resolveFunction<T>(i: T): T extends () => infer R ? R : T {
return typeof i === 'function' ? i() : i
}
@ -90,10 +93,10 @@ export const useCommandRegistry = defineStore('command', () => {
.filter(command => command.visible ? command.visible() : true)
.map(provider => ({
...provider,
icon: r(provider.icon),
name: r(provider.name),
description: r(provider.description),
bindings: r(provider.bindings),
icon: resolveFunction(provider.icon),
name: resolveFunction(provider.name),
description: resolveFunction(provider.description),
bindings: resolveFunction(provider.bindings),
})))
let lastScope = ''