|
| 1 | +import { Vue } from "./vue.d"; |
| 2 | +import { VNode, VNodeDirective } from "./vnode.d"; |
| 3 | + |
| 4 | +type Constructor = { |
| 5 | + new (...args: any[]): any; |
| 6 | +} |
| 7 | + |
| 8 | +export interface ComponentOptions { |
| 9 | + data?: Object | ( (this: Vue) => Object ); |
| 10 | + props?: string[] | { [key: string]: PropOptions | Constructor | Constructor[] }; |
| 11 | + propsData?: Object; |
| 12 | + computed?: { [key: string]: ((this: Vue) => any) | ComputedOptions }; |
| 13 | + methods?: { [key: string]: Function }; |
| 14 | + watch?: { [key: string]: ({ handler: WatchHandler } & WatchOptions) | WatchHandler | string }; |
| 15 | + |
| 16 | + el?: Element | String; |
| 17 | + template?: string; |
| 18 | + render?(createElement: typeof Vue.prototype.$createElement): VNode; |
| 19 | + staticRenderFns?: (() => VNode)[]; |
| 20 | + |
| 21 | + beforeCreate?(): void; |
| 22 | + created?(): void; |
| 23 | + beforeDestroy?(): void; |
| 24 | + destroyed?(): void; |
| 25 | + beforeMount?(): void; |
| 26 | + mounted?(): void; |
| 27 | + beforeUpdate?(): void; |
| 28 | + updated?(): void; |
| 29 | + |
| 30 | + directives?: { [key: string]: DirectiveOptions | DirectiveFunction }; |
| 31 | + components?: { [key: string]: ComponentOptions | typeof Vue }; |
| 32 | + transitions?: { [key: string]: Object }; |
| 33 | + filters?: { [key: string]: Function }; |
| 34 | + |
| 35 | + parent?: Vue; |
| 36 | + mixins?: (ComponentOptions | typeof Vue)[]; |
| 37 | + name?: string; |
| 38 | + extends?: ComponentOptions | typeof Vue; |
| 39 | + delimiters?: [string, string]; |
| 40 | +} |
| 41 | + |
| 42 | +export interface PropOptions { |
| 43 | + type?: Constructor | Constructor[] | null; |
| 44 | + required?: boolean; |
| 45 | + default?: any; |
| 46 | + validator?(value: any): boolean; |
| 47 | +} |
| 48 | + |
| 49 | +export interface ComputedOptions { |
| 50 | + get?(this: Vue): any; |
| 51 | + set?(this: Vue, value: any): void; |
| 52 | + cache?: boolean; |
| 53 | +} |
| 54 | + |
| 55 | +export type WatchHandler = <T>(val: T, oldVal: T) => void; |
| 56 | + |
| 57 | +export interface WatchOptions { |
| 58 | + deep?: boolean; |
| 59 | + immediate?: boolean; |
| 60 | +} |
| 61 | + |
| 62 | +export type DirectiveFunction = ( |
| 63 | + el: HTMLElement, |
| 64 | + binding: VNodeDirective, |
| 65 | + vnode: VNode, |
| 66 | + oldVnode: VNode |
| 67 | +) => void; |
| 68 | + |
| 69 | +export interface DirectiveOptions { |
| 70 | + bind?: DirectiveFunction; |
| 71 | + update?: DirectiveFunction; |
| 72 | + componentUpdated?: DirectiveFunction; |
| 73 | + unbind?: DirectiveFunction; |
| 74 | +} |
0 commit comments