mirror of
https://github.com/vuejs/vue.git
synced 2024-11-22 04:39:46 +00:00
fix(types): type support for advanced async components (#8438)
This commit is contained in:
parent
8a2dbf5010
commit
dfaf9e2436
14
types/options.d.ts
vendored
14
types/options.d.ts
vendored
@ -16,11 +16,23 @@ interface EsModuleComponent {
|
||||
default: Component
|
||||
}
|
||||
|
||||
export type AsyncComponent<Data=DefaultData<never>, Methods=DefaultMethods<never>, Computed=DefaultComputed, Props=DefaultProps> = (
|
||||
export type AsyncComponent<Data=DefaultData<never>, Methods=DefaultMethods<never>, Computed=DefaultComputed, Props=DefaultProps>
|
||||
= AsyncComponentPromise<Data, Methods, Computed, Props>
|
||||
| AsyncComponentFactory<Data, Methods, Computed, Props>
|
||||
|
||||
export type AsyncComponentPromise<Data=DefaultData<never>, Methods=DefaultMethods<never>, Computed=DefaultComputed, Props=DefaultProps> = (
|
||||
resolve: (component: Component<Data, Methods, Computed, Props>) => void,
|
||||
reject: (reason?: any) => void
|
||||
) => Promise<Component | EsModuleComponent> | void;
|
||||
|
||||
export type AsyncComponentFactory<Data=DefaultData<never>, Methods=DefaultMethods<never>, Computed=DefaultComputed, Props=DefaultProps> = () => {
|
||||
component: AsyncComponentPromise<Data, Methods, Computed, Props>;
|
||||
loading?: Component | EsModuleComponent;
|
||||
error?: Component | EsModuleComponent;
|
||||
delay?: number;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* When the `Computed` type parameter on `ComponentOptions` is inferred,
|
||||
* it should have a property with the return type of every get-accessor.
|
||||
|
Loading…
Reference in New Issue
Block a user