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>
|
||||
}
|
||||
|
||||
type PluginInstallFunction<Options> = Options extends unknown[]
|
||||
type PluginInstallFunction<Options = any[]> = Options extends unknown[]
|
||||
? (app: App, ...options: Options) => any
|
||||
: (app: App, options: Options) => any
|
||||
|
||||
export type Plugin<Options = any[]> =
|
||||
| (PluginInstallFunction<Options> & {
|
||||
install?: PluginInstallFunction<Options>
|
||||
})
|
||||
| {
|
||||
export type ObjectPlugin<Options = any[]> = {
|
||||
install: PluginInstallFunction<Options>
|
||||
}
|
||||
}
|
||||
export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> &
|
||||
Partial<ObjectPlugin<Options>>
|
||||
|
||||
export type Plugin<Options = any[]> =
|
||||
| FunctionPlugin<Options>
|
||||
| ObjectPlugin<Options>
|
||||
|
||||
export function createAppContext(): AppContext {
|
||||
return {
|
||||
|
|
|
@ -212,6 +212,8 @@ export type {
|
|||
AppConfig,
|
||||
AppContext,
|
||||
Plugin,
|
||||
ObjectPlugin,
|
||||
FunctionPlugin,
|
||||
CreateAppFunction,
|
||||
OptionMergeFunction
|
||||
} from './apiCreateApp'
|
||||
|
|
Loading…
Reference in New Issue