feat(types): export ObjectPlugin and FunctionPlugin types (#8946)
close #8577
This commit is contained in:
parent
982a145d38
commit
fa4969e7a3
|
@ -149,17 +149,19 @@ export interface AppContext {
|
||||||
filters?: Record<string, Function>
|
filters?: Record<string, Function>
|
||||||
}
|
}
|
||||||
|
|
||||||
type PluginInstallFunction<Options> = Options extends unknown[]
|
type PluginInstallFunction<Options = any[]> = Options extends unknown[]
|
||||||
? (app: App, ...options: Options) => any
|
? (app: App, ...options: Options) => any
|
||||||
: (app: App, options: Options) => any
|
: (app: App, options: Options) => any
|
||||||
|
|
||||||
|
export type ObjectPlugin<Options = any[]> = {
|
||||||
|
install: PluginInstallFunction<Options>
|
||||||
|
}
|
||||||
|
export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> &
|
||||||
|
Partial<ObjectPlugin<Options>>
|
||||||
|
|
||||||
export type Plugin<Options = any[]> =
|
export type Plugin<Options = any[]> =
|
||||||
| (PluginInstallFunction<Options> & {
|
| FunctionPlugin<Options>
|
||||||
install?: PluginInstallFunction<Options>
|
| ObjectPlugin<Options>
|
||||||
})
|
|
||||||
| {
|
|
||||||
install: PluginInstallFunction<Options>
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createAppContext(): AppContext {
|
export function createAppContext(): AppContext {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -212,6 +212,8 @@ export type {
|
||||||
AppConfig,
|
AppConfig,
|
||||||
AppContext,
|
AppContext,
|
||||||
Plugin,
|
Plugin,
|
||||||
|
ObjectPlugin,
|
||||||
|
FunctionPlugin,
|
||||||
CreateAppFunction,
|
CreateAppFunction,
|
||||||
OptionMergeFunction
|
OptionMergeFunction
|
||||||
} from './apiCreateApp'
|
} from './apiCreateApp'
|
||||||
|
|
Loading…
Reference in New Issue