File tree 4 files changed +8
-1
lines changed
4 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ declare interface GlobalAPI {
16
16
component : ( id : string , def ?: Class < Component > | Object) => Class < Component > ;
17
17
filter: (id: string, def?: Function) => Function | void ;
18
18
19
+ observable : < T > (value: T) => T ;
20
+
19
21
// allow dynamic method registration
20
22
[ key : string ] : any
21
23
} ;
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export function initGlobalAPI (Vue: GlobalAPI) {
46
46
Vue . nextTick = nextTick
47
47
48
48
// 2.6 explicit observable API
49
- Vue . observable = ( obj : any ) : any => {
49
+ Vue . observable = < T > (obj: T ): T => {
50
50
observe ( obj )
51
51
return obj
52
52
}
Original file line number Diff line number Diff line change @@ -200,3 +200,6 @@ declare function decorate<VC extends typeof Vue>(v: VC): VC;
200
200
class Decorated extends Vue {
201
201
a = 123 ;
202
202
}
203
+
204
+ const obj = Vue . observable ( { a : 1 } )
205
+ obj . a ++
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ export interface VueConstructor<V extends Vue = Vue> {
119
119
staticRenderFns : ( ( ) => VNode ) [ ] ;
120
120
} ;
121
121
122
+ observable < T > ( obj : T ) : T ;
123
+
122
124
config : VueConfiguration ;
123
125
}
124
126
You can’t perform that action at this time.
0 commit comments