Skip to content

Commit

Permalink
fix(types): bump ts version and fix typing bugs (#7135)
Browse files Browse the repository at this point in the history
  • Loading branch information
HerringtonDarkholme authored and yyx990803 committed Nov 27, 2017
1 parent 8b43c81 commit a71e653
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 40 deletions.
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"selenium-server": "^2.53.1",
"serialize-javascript": "^1.3.0",
"shelljs": "^0.7.8",
"typescript": "^2.5.2",
"typescript": "^2.6.1",
"uglify-js": "^3.0.15",
"webpack": "^2.6.1",
"weex-js-runtime": "^0.23.0",
Expand Down
3 changes: 1 addition & 2 deletions types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ type Constructor = {
export type Component<Data=DefaultData<Vue>, Methods=DefaultMethods<Vue>, Computed=DefaultComputed, Props=DefaultProps> =
| typeof Vue
| FunctionalComponentOptions<Props>
| ThisTypedComponentOptionsWithArrayProps<Vue, Data, Methods, Computed, keyof Props>
| ThisTypedComponentOptionsWithRecordProps<Vue, Data, Methods, Computed, Props>;
| ComponentOptions<Vue, Data, Methods, Computed, Props>

interface EsModuleComponent {
default: Component
Expand Down
7 changes: 5 additions & 2 deletions types/test/options-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Vue.component('component', {
bind() {},
inserted() {},
update() {},
componentMounted() {},
componentUpdated() {},
unbind() {}
},
b(el, binding, vnode, oldVnode) {
Expand Down Expand Up @@ -310,7 +310,10 @@ Vue.component("async-component", ((resolve, reject) => {
resolve(Vue.component("component"));
}, 0);
return new Promise((resolve) => {
resolve({ functional: true });
resolve({
functional: true,
render(h: CreateElement) { return h('div') }
});
})
}));

Expand Down
8 changes: 4 additions & 4 deletions types/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { VNode, VNodeData, VNodeChildren, ScopedSlot } from "./vnode";
import { PluginFunction, PluginObject } from "./plugin";

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

export interface Vue {
Expand Down Expand Up @@ -72,7 +72,7 @@ export interface VueConstructor<V extends Vue = Vue> {

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

Expand All @@ -94,7 +94,7 @@ export interface VueConstructor<V extends Vue = Vue> {
component<Data, Methods, Computed, Props>(id: string, definition: AsyncComponent<Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
component<PropNames extends string>(id: string, definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
component<Props>(id: string, definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
component<Data, Methods, Computed, PropNames extends string>(id: string, definition?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
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>>;
component<Data, Methods, Computed, Props>(id: string, definition?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
component(id: string, definition?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;

Expand Down

0 comments on commit a71e653

Please sign in to comment.