Skip to content

Commit a71e653

Browse files
HerringtonDarkholmeyyx990803
authored andcommitted
fix(types): bump ts version and fix typing bugs (#7135)
1 parent 8b43c81 commit a71e653

File tree

5 files changed

+42
-40
lines changed

5 files changed

+42
-40
lines changed

package-lock.json

+31-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"selenium-server": "^2.53.1",
123123
"serialize-javascript": "^1.3.0",
124124
"shelljs": "^0.7.8",
125-
"typescript": "^2.5.2",
125+
"typescript": "^2.6.1",
126126
"uglify-js": "^3.0.15",
127127
"webpack": "^2.6.1",
128128
"weex-js-runtime": "^0.23.0",

types/options.d.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ type Constructor = {
99
export type Component<Data=DefaultData<Vue>, Methods=DefaultMethods<Vue>, Computed=DefaultComputed, Props=DefaultProps> =
1010
| typeof Vue
1111
| FunctionalComponentOptions<Props>
12-
| ThisTypedComponentOptionsWithArrayProps<Vue, Data, Methods, Computed, keyof Props>
13-
| ThisTypedComponentOptionsWithRecordProps<Vue, Data, Methods, Computed, Props>;
12+
| ComponentOptions<Vue, Data, Methods, Computed, Props>
1413

1514
interface EsModuleComponent {
1615
default: Component

types/test/options-test.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Vue.component('component', {
196196
bind() {},
197197
inserted() {},
198198
update() {},
199-
componentMounted() {},
199+
componentUpdated() {},
200200
unbind() {}
201201
},
202202
b(el, binding, vnode, oldVnode) {
@@ -310,7 +310,10 @@ Vue.component("async-component", ((resolve, reject) => {
310310
resolve(Vue.component("component"));
311311
}, 0);
312312
return new Promise((resolve) => {
313-
resolve({ functional: true });
313+
resolve({
314+
functional: true,
315+
render(h: CreateElement) { return h('div') }
316+
});
314317
})
315318
}));
316319

types/vue.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { VNode, VNodeData, VNodeChildren, ScopedSlot } from "./vnode";
1616
import { PluginFunction, PluginObject } from "./plugin";
1717

1818
export interface CreateElement {
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;
19+
(tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any> | (() => Component), children?: VNodeChildren): VNode;
20+
(tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any> | (() => Component), data?: VNodeData, children?: VNodeChildren): VNode;
2121
}
2222

2323
export interface Vue {
@@ -72,7 +72,7 @@ export interface VueConstructor<V extends Vue = Vue> {
7272

7373
extend<PropNames extends string = never>(definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
7474
extend<Props>(definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
75-
extend<Data, Methods, Computed, PropNames extends string>(options?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
75+
extend<Data, Methods, Computed, PropNames extends string = never>(options?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
7676
extend<Data, Methods, Computed, Props>(options?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
7777
extend(options?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
7878

@@ -94,7 +94,7 @@ export interface VueConstructor<V extends Vue = Vue> {
9494
component<Data, Methods, Computed, Props>(id: string, definition: AsyncComponent<Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
9595
component<PropNames extends string>(id: string, definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
9696
component<Props>(id: string, definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
97-
component<Data, Methods, Computed, PropNames extends string>(id: string, definition?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
97+
component<Data, Methods, Computed, PropNames extends string = never>(id: string, definition?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
9898
component<Data, Methods, Computed, Props>(id: string, definition?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
9999
component(id: string, definition?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
100100

0 commit comments

Comments
 (0)