@ -3,50 +3,39 @@ import {
AsyncComponent ,
ComponentOptions ,
FunctionalComponentOptions ,
WatchOptions ,
WatchOptionsWithHandler ,
WatchHandler ,
DirectiveOptions ,
DirectiveFunction
DirectiveFunction ,
RecordPropsDefinition ,
ThisTypedComponentOptionsWithArrayProps ,
ThisTypedComponentOptionsWithRecordProps ,
WatchOptions ,
} from "./options" ;
import { VNode , VNodeData , VNodeChildren , ScopedSlot } from "./vnode" ;
import { PluginFunction , PluginObject } from "./plugin" ;
export type CreateElement = {
// empty node
( ) : VNode ;
// element or component name
( tag : string , children : VNodeChildren ) : VNode ;
( tag : string , data? : VNodeData , children? : VNodeChildren ) : VNode ;
// component constructor or options
( tag : Component , children : VNodeChildren ) : VNode ;
( tag : Component , data? : VNodeData , children? : VNodeChildren ) : VNode ;
// async component
( tag : AsyncComponent , children : VNodeChildren ) : VNode ;
( tag : AsyncComponent , data? : VNodeData , children? : VNodeChildren ) : VNode ;
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 ;
}
export declare class Vue {
constructor ( options? : ComponentOptions < Vue > ) ;
$data : Object ;
export interface Vue {
readonly $el : HTMLElement ;
readonly $options : ComponentOptions < this > ;
readonly $parent : Vue ;
readonly $root : Vue ;
readonly $children : Vue [ ] ;
readonly $refs : { [ key : string ] : Vue | Element | Vue [ ] | Element [ ] } ;
readonly $refs : { [ key : string ] : Vue | Element | Vue [ ] | Element [ ] } ;
readonly $slots : { [ key : string ] : VNode [ ] } ;
readonly $scopedSlots : { [ key : string ] : ScopedSlot } ;
readonly $isServer : boolean ;
readonly $data : Record < string , any > ;
readonly $props : Record < string , any > ;
readonly $ssrContext : any ;
readonly $props : any ;
readonly $vnode : VNode ;
readonly $attrs : { [ key : string ] : string } ;
readonly $listeners : { [ key : string ] : Function | Array < Function > } ;
readonly $attrs : Record < string , string > ;
readonly $listeners : Record < string , Function | Function [ ] > ;
$mount ( elementOrSelector? : Element | String , hydrating? : boolean ) : this ;
$forceUpdate ( ) : void ;
@ -55,12 +44,12 @@ export declare class Vue {
$delete : typeof Vue . delete ;
$watch (
expOrFn : string ,
callback : WatchHandler < this , any > ,
callback : ( this : this , n : any , o : any ) = > void ,
options? : WatchOptions
) : ( ( ) = > void ) ;
$watch < T > (
expOrFn : ( this : this ) = > T ,
callback : WatchHandler < this , T > ,
callback : ( this : this , n : T , o : T ) = > void ,
options? : WatchOptions
) : ( ( ) = > void ) ;
$on ( event : string | string [ ] , callback : Function ) : this ;
@ -70,8 +59,54 @@ export declare class Vue {
$nextTick ( callback : ( this : this ) = > void ) : void ;
$nextTick ( ) : Promise < void > ;
$createElement : CreateElement ;
}
export type CombinedVueInstance < Instance extends Vue , Data , Methods , Computed , Props > = Instance & Data & Methods & Computed & Props ;
export type ExtendedVue < Instance extends Vue , Data , Methods , Computed , Props > = VueConstructor < CombinedVueInstance < Instance , Data , Methods , Computed , Props > & Vue > ;
export interface VueConstructor < V extends Vue = Vue > {
new < Data = object , Methods = object , Computed = object , PropNames extends string = never > ( options? : ThisTypedComponentOptionsWithArrayProps < V , Data , Methods , Computed , PropNames > ) : CombinedVueInstance < V , Data , Methods , Computed , Record < PropNames , any > > ;
// ideally, the return type should just contains Props, not Record<keyof Props, any>. But TS requires Base constructors must all have the same return type.
new < Data = object , Methods = object , Computed = object , Props = object > ( options? : ThisTypedComponentOptionsWithRecordProps < V , Data , Methods , Computed , Props > ) : CombinedVueInstance < V , Data , Methods , Computed , Record < keyof Props , any > > ;
new ( options? : ComponentOptions < V > ) : CombinedVueInstance < V , object , object , object , Record < keyof object , any > > ;
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 , Props > ( options? : ThisTypedComponentOptionsWithRecordProps < V , Data , Methods , Computed , Props > ) : ExtendedVue < V , Data , Methods , Computed , Props > ;
extend ( options? : ComponentOptions < V > ) : ExtendedVue < V , {} , {} , {} , {} > ;
nextTick ( callback : ( ) = > void , context? : any [ ] ) : void ;
nextTick ( ) : Promise < void >
set < T > ( object : Object , key : string , value : T ) : T ;
set < T > ( array : T [ ] , key : number , value : T ) : T ;
delete ( object : Object , key : string ) : void ;
delete < T > ( array : T [ ] , key : number ) : void ;
directive (
id : string ,
definition? : DirectiveOptions | DirectiveFunction
) : DirectiveOptions ;
filter ( id : string , definition? : Function ) : Function ;
static config : {
component ( id : string ) : VueConstructor ;
component < VC extends VueConstructor > ( id : string , constructor : VC ) : VC ;
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 , Props > ( id : string , definition? : ThisTypedComponentOptionsWithRecordProps < V , Data , Methods , Computed , Props > ) : ExtendedVue < V , Data , Methods , Computed , Props > ;
component ( id : string , definition? : ComponentOptions < V > ) : ExtendedVue < V , {} , {} , {} , {} > ;
use < T > ( plugin : PluginObject < T > | PluginFunction < T > , options? : T ) : void ;
use ( plugin : PluginObject < any > | PluginFunction < any > , . . . options : any [ ] ) : void ;
mixin ( mixin : VueConstructor | ComponentOptions < Vue > ) : void ;
compile ( template : string ) : {
render ( createElement : typeof Vue . prototype . $createElement ) : VNode ;
staticRenderFns : ( ( ) = > VNode ) [ ] ;
} ;
config : {
silent : boolean ;
optionMergeStrategies : any ;
devtools : boolean ;
@ -82,27 +117,6 @@ export declare class Vue {
ignoredElements : string [ ] ;
keyCodes : { [ key : string ] : number | number [ ] } ;
}
static extend ( options : ComponentOptions < Vue > | FunctionalComponentOptions ) : typeof Vue ;
static nextTick ( callback : ( ) = > void , context? : any [ ] ) : void ;
static nextTick ( ) : Promise < void >
static set < T > ( object : Object , key : string , value : T ) : T ;
static set < T > ( array : T [ ] , key : number , value : T ) : T ;
static delete ( object : Object , key : string ) : void ;
static delete < T > ( array : T [ ] , key : number ) : void ;
static directive (
id : string ,
definition? : DirectiveOptions | DirectiveFunction
) : DirectiveOptions ;
static filter ( id : string , definition? : Function ) : Function ;
static component ( id : string , definition? : Component | AsyncComponent ) : typeof Vue ;
static use < T > ( plugin : PluginObject < T > | PluginFunction < T > , options? : T ) : void ;
static use ( plugin : PluginObject < any > | PluginFunction < any > , . . . options : any [ ] ) : void ;
static mixin ( mixin : typeof Vue | ComponentOptions < Vue > ) : void ;
static compile ( template : string ) : {
render ( createElement : typeof Vue . prototype . $createElement ) : VNode ;
staticRenderFns : ( ( ) = > VNode ) [ ] ;
} ;
}
export const Vue : VueConstructor ;