Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify 'CreateElement', remove potential error in 'AsyncComponent' … #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface EsModuleComponent {
export type AsyncComponent<Data=DefaultData<Vue>, Methods=DefaultMethods<Vue>, Computed=DefaultComputed, Props=DefaultProps> = (
resolve: (component: Component<Data, Methods, Computed, Props>) => void,
reject: (reason?: any) => void
) => Promise<Component | EsModuleComponent> | Component | void;
) => Promise<Component | EsModuleComponent> | void;

/**
* When the `Computed` type parameter on `ComponentOptions` is inferred,
Expand Down
5 changes: 0 additions & 5 deletions types/test/options-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ Vue.component('component', {

createElement(() => Vue.component("component")),
createElement(() => ( {} as ComponentOptions<Vue> )),
createElement(() => {
return new Promise((resolve) => {
resolve({} as ComponentOptions<Vue>);
})
}),
createElement((resolve, reject) => {
resolve({} as ComponentOptions<Vue>);
reject();
Expand Down
16 changes: 2 additions & 14 deletions types/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,8 @@ import { VNode, VNodeData, VNodeChildren, ScopedSlot } from "./vnode";
import { PluginFunction, PluginObject } from "./plugin";

export interface CreateElement {
// empty node
(): VNode;

// element or component name
(tag: string, children: VNodeChildren): VNode;
(tag: string, data?: VNodeData, children?: VNodeChildren): VNode;

// component constructor or options
(tag: Component<any, any, any, any>, children: VNodeChildren): VNode;
(tag: Component<any, any, any, any>, data?: VNodeData, children?: VNodeChildren): VNode;

// async component
(tag: AsyncComponent<any, any, any, any>, children: VNodeChildren): VNode;
(tag: AsyncComponent<any, any, any, any>, data?: VNodeData, children?: VNodeChildren): VNode;
(tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any>, children?: VNodeChildren): VNode;
(tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any>, data?: VNodeData, children?: VNodeChildren): VNode;
}

export interface Vue {
Expand Down