From 76d4ef63fd3b2f19e3fe1727fa474408793141da Mon Sep 17 00:00:00 2001 From: Kaoru Hagihara Date: Sun, 6 Mar 2016 01:12:52 +0900 Subject: [PATCH] fix vue.js simplify definitions --- vue/vue.d.ts | 90 ++++++++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 56 deletions(-) diff --git a/vue/vue.d.ts b/vue/vue.d.ts index 8224cfd94..f0af82ea1 100644 --- a/vue/vue.d.ts +++ b/vue/vue.d.ts @@ -97,64 +97,42 @@ declare namespace vuejs { [key: string]: any; } - // instance/api/data.js - interface $get { (exp: string, asStatement?: boolean): any; } - interface $set { (key: string | number, value: T): T; } - interface $delete { (key: string): void; } - interface $watch { (expOrFn: string | Function, callback: ((newVal: any, oldVal?: any) => any) | string, options?: { deep?: boolean, immidiate?: boolean }): Function; } - interface $eval { (expression: string): string; } - interface $interpolate { (expression: string): string; } - interface $log { (keypath?: string): void; } - // instance/api/dom.js - interface $nextTick { (callback: Function): void; } - interface $appendTo { (target: (HTMLElement | string), callback?: Function, withTransition?: boolean): V; } - interface $prependTo { (target: (HTMLElement | string), callback?: Function, withTransition?: boolean): V; } - interface $before { (target: (HTMLElement | string), callback?: Function, withTransition?: boolean): V; } - interface $after { (target: (HTMLElement | string), callback?: Function, withTransition?: boolean): V; } - interface $remove { (callback?: Function): V; } - // instance/api/events.js - interface $on { (event: string, callback: Function): V; } - interface $once { (event: string, callback: Function): V; } - interface $off { (event?: string, callback?: Function): V; } - interface $emit { (event: string, ...args: any[]): V; } - interface $broadcast { (event: string, ...args: any[]): V; } - interface $dispatch { (event: string, ...args: any[]): V; } - // instance/api/lifecycle.js - interface $mount { (elementOrSelector?: (HTMLElement | string)): V; } - interface $destroy { (remove?: boolean): void; } - interface $compile { (el: Element | DocumentFragment, host?: Vue): Function; } - interface Vue { - $data?: any; - $el?: HTMLElement; - $options?: Object; - $parent?: Vue; - $root?: Vue; - $children?: Vue[]; - $refs?: Object; - $els?: Object; + $data: any; + $el: HTMLElement; + $options: Object; + $parent: Vue; + $root: Vue; + $children: Vue[]; + $refs: Object; + $els: Object; - $get?: $get; - $set?: $set; - $delete?: $delete; - $eval?: $eval; - $interpolate?: $interpolate; - $log?: $log; - $watch?: $watch; - $on?: $on; - $once?: $once; - $off?: $off; - $emit?: $emit; - $dispatch?: $dispatch; - $broadcast?: $broadcast; - $appendTo?: $appendTo; - $before?: $before; - $after?: $after; - $remove?: $remove; - $nextTick?: $nextTick; - $mount?: $mount; - $destroy?: $destroy; - $compile?: $compile; + // instance/api/data.js + $get(exp: string, asStatement?: boolean): any; + $set(key: string | number, value: T): T; + $delete(key: string): void; + $eval(expression: string): string; + $interpolate(expression: string): string; + $log(keypath?: string): void; + $watch(expOrFn: string | Function, callback: ((newVal: any, oldVal?: any) => any) | string, options?: { deep?: boolean, immidiate?: boolean }): Function; + // instance/api/dom.js + $nextTick(callback: Function): void; + $appendTo(target: (HTMLElement | string), callback?: Function, withTransition?: boolean): this; + $prependTo(target: (HTMLElement | string), callback?: Function, withTransition?: boolean); this; + $before(target: (HTMLElement | string), callback?: Function, withTransition?: boolean): this; + $after(target: (HTMLElement | string), callback?: Function, withTransition?: boolean): this; + $remove(callback?: Function): this; + // instance/api/events.js + $on(event: string, callback: Function): this; + $once(event: string, callback: Function): this; + $off(event: string, callback?: Function): this; + $emit(event: string, ...args: any[]): this; + $broadcast(event: string, ...args: any[]): this; + $dispatch(event: string, ...args: any[]): this; + // instance/api/lifecycle.js + $mount(elementOrSelector?: (HTMLElement | string)): this; + $destroy(remove?: boolean): void; + $compile(el: Element | DocumentFragment, host?: Vue): Function; _init(options?: ComponentOption): void; }