Skip to content

Commit 280e241

Browse files
committed
rename PluginObject to match vue3
1 parent 4d57f2f commit 280e241

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/auth/service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { md5, randomString, toQueryString } from '@/shared/utils'
22
import { config } from '@/shared/config'
33
import { inject } from 'vue'
4-
import { App, PluginObject } from '@/shared/compat'
4+
import { App, Plugin } from '@/shared/compat'
55
import { pickBy } from 'lodash-es'
66

77
type Auth = { password?: string, salt?: string, hash?: string }
@@ -144,7 +144,7 @@ export function useAuth(): AuthService {
144144
return inject(apiSymbol) as AuthService
145145
}
146146

147-
export function createAuth(): AuthService & PluginObject<never> {
147+
export function createAuth(): AuthService & Plugin {
148148
const instance = new AuthService()
149149
return Object.assign(instance, {
150150
install: (app: App) => {

src/shared/compat.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Vue from 'vue'
44
export interface App<T = any> {
55
config: VueConstructor['config'] & {globalProperties: any}
66
// eslint-disable-next-line no-use-before-define
7-
use(plugin: PluginObject<T>, options?: T): this
7+
use(plugin: Plugin<T>, options?: T): this
88
component: VueConstructor['component']
99
provide<T>(key: symbol | string, value: T): this
1010
mount: Vue['$mount']
@@ -13,15 +13,15 @@ export interface App<T = any> {
1313
// unmount: Vue['$destroy']
1414
}
1515

16-
export interface PluginObject<T> {
16+
export interface Plugin<T = any> {
1717
install: (app: App<T>, options?: T) => void
1818
}
1919

2020
export const createApp = (component: any, options: any): App => {
2121
const provide: Record<any, any> = {}
2222
let vm = undefined as undefined | Vue
2323
return {
24-
use<T>(plugin: PluginObject<T>, options?: T) {
24+
use<T>(plugin: Plugin<T>, options?: T) {
2525
(plugin as any).install(this, options)
2626
return this
2727
},

src/shared/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { API } from '@/shared/api'
22
import { inject } from 'vue'
33
import { AuthService } from '@/auth/service'
4-
import { App, PluginObject } from '@/shared/compat'
4+
import { App, Plugin } from '@/shared/compat'
55

66
const apiSymbol = Symbol('')
77

88
export function useApi(): API {
99
return inject(apiSymbol) as API
1010
}
1111

12-
export function createApi(auth: AuthService): API & PluginObject<never> {
12+
export function createApi(auth: AuthService): API & Plugin {
1313
const instance = new API(auth)
1414
return Object.assign(instance, {
1515
install: (app: App) => {

0 commit comments

Comments
 (0)