Skip to content

Commit 8901752

Browse files
Merge pull request vuejs#1 from DanielRosenwasser/simplifyCreateElement
Simplify 'CreateElement', remove potential error in 'AsyncComponent' …
2 parents 1ac0b7a + c953990 commit 8901752

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

types/options.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface EsModuleComponent {
1919
export type AsyncComponent<Data=DefaultData<Vue>, Methods=DefaultMethods<Vue>, Computed=DefaultComputed, Props=DefaultProps> = (
2020
resolve: (component: Component<Data, Methods, Computed, Props>) => void,
2121
reject: (reason?: any) => void
22-
) => Promise<Component | EsModuleComponent> | Component | void;
22+
) => Promise<Component | EsModuleComponent> | void;
2323

2424
/**
2525
* When the `Computed` type parameter on `ComponentOptions` is inferred,

types/test/options-test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,6 @@ Vue.component('component', {
163163

164164
createElement(() => Vue.component("component")),
165165
createElement(() => ( {} as ComponentOptions<Vue> )),
166-
createElement(() => {
167-
return new Promise((resolve) => {
168-
resolve({} as ComponentOptions<Vue>);
169-
})
170-
}),
171166
createElement((resolve, reject) => {
172167
resolve({} as ComponentOptions<Vue>);
173168
reject();

types/vue.d.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,8 @@ import { VNode, VNodeData, VNodeChildren, ScopedSlot } from "./vnode";
1616
import { PluginFunction, PluginObject } from "./plugin";
1717

1818
export interface CreateElement {
19-
// empty node
20-
(): VNode;
21-
22-
// element or component name
23-
(tag: string, children: VNodeChildren): VNode;
24-
(tag: string, data?: VNodeData, children?: VNodeChildren): VNode;
25-
26-
// component constructor or options
27-
(tag: Component<any, any, any, any>, children: VNodeChildren): VNode;
28-
(tag: Component<any, any, any, any>, data?: VNodeData, children?: VNodeChildren): VNode;
29-
30-
// async component
31-
(tag: AsyncComponent<any, any, any, any>, children: VNodeChildren): VNode;
32-
(tag: AsyncComponent<any, any, any, any>, data?: VNodeData, children?: VNodeChildren): VNode;
19+
(tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any>, children?: VNodeChildren): VNode;
20+
(tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any>, data?: VNodeData, children?: VNodeChildren): VNode;
3321
}
3422

3523
export interface Vue {

0 commit comments

Comments
 (0)