Skip to content

Commit

Permalink
chore: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz committed Feb 4, 2024
1 parent fca27ca commit 03c816e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions packages/devtools-kit/src/api/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PluginDescriptor, PluginSetupFunction, VueAppInstance } from '../types'
import type { App } from 'vue'
import { PluginDescriptor, PluginSetupFunction } from '../types'
import { devtoolsAppRecords, devtoolsState } from '../state'
import { hook } from '../hook'
import { getRouterDevToolsId } from '../core/router'
Expand All @@ -12,7 +13,7 @@ export function setupDevToolsPlugin(pluginDescriptor: PluginDescriptor, setupFn:
return hook.setupDevToolsPlugin(pluginDescriptor, setupFn)
}

export function registerPlugin(app: VueAppInstance, api: DevToolsPluginApi) {
export function registerPlugin(app: App<any>, api: DevToolsPluginApi) {
const plugins = devtoolsState.pluginBuffer.filter(([plugin]) => plugin.app === app)
plugins.forEach(async ([plugin, setupFn]) => {
if (plugin.packageName === 'vue-query') {
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools-kit/src/core/app-record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export function createAppRecord(app: VueAppInstance['appContext']['app']): AppRe
}

export async function setActiveAppRecord(appRecord: AppRecord) {
await registerComponentDevToolsPlugin(appRecord?.app as unknown as VueAppInstance)
registerComponentDevToolsPlugin(appRecord?.app as unknown as VueAppInstance)
devtoolsAppRecords.active = appRecord
devtoolsAppRecords.activeId = `${appRecord.id}`
registerPlugin(appRecord.app as unknown as VueAppInstance, appRecord.api!)
registerPlugin(appRecord.app!, appRecord.api!)
}

export async function toggleActiveAppRecord(id: string) {
Expand Down
1 change: 0 additions & 1 deletion packages/devtools-kit/src/plugins/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export function registerComponentDevToolsPlugin(app: VueAppInstance) {
})

api.on.editInspectorState(async (payload) => {
// @ts-expect-error expected type
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
editState(payload)
await api.sendInspectorState('components')
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools-kit/src/types/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export declare type PluginSettingsItem = {
export interface PluginDescriptor {
id: string
label: string
app: VueAppInstance
app: App<any>
packageName?: string
homepage?: string
componentStateTypes?: string[]
Expand Down Expand Up @@ -82,7 +82,7 @@ export type VueAppInstance = ComponentInternalInstance & {
setupState: Record<string, unknown>
provides: Record<string | symbol, unknown>
ctx: Record<string, unknown>
}
} & App<any>
export interface AppRecord {
id: string | number
name: string
Expand Down

0 comments on commit 03c816e

Please sign in to comment.