File tree 2 files changed +49
-0
lines changed
2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 3
3
"version" : " 3.5.0" ,
4
4
"description" : " Async computed properties for Vue" ,
5
5
"main" : " dist/vue-async-computed.js" ,
6
+ "types" : " types/index.d.ts" ,
6
7
"files" : [
7
8
" bin/" ,
8
9
" dist/"
Original file line number Diff line number Diff line change
1
+ import Vue , { PluginFunction } from "vue" ;
2
+
3
+ export interface IAsyncComputedOptions {
4
+ errorHandler ?: ( error : string | Error ) => void ;
5
+ useRawError ?: boolean ;
6
+ }
7
+
8
+ export default class AsyncComputed {
9
+ constructor ( options ?: IAsyncComputedOptions )
10
+ static install : PluginFunction < never > ;
11
+ static version : string ;
12
+ }
13
+
14
+ type AsyncComputedGetter < T > = ( ) => Promise < T > ;
15
+ interface IAsyncComputedProperty < T > {
16
+ default ?: T | ( ( ) => T ) ;
17
+ get : AsyncComputedGetter < T > ;
18
+ watch ?: ( ) => void ;
19
+ shouldUpdate ?: ( ) => boolean ;
20
+ lazy ?: boolean ;
21
+ }
22
+
23
+ interface IAsyncComputedProperties {
24
+ [ K : string ] : AsyncComputedGetter < any > | IAsyncComputedProperty < any > ;
25
+ }
26
+
27
+ declare module "vue/types/options" {
28
+ // tslint:disable-next-line:interface-name
29
+ interface ComponentOptions < V extends Vue > {
30
+ asyncComputed ?: IAsyncComputedProperties ;
31
+ }
32
+ }
33
+
34
+ interface IASyncComputedState {
35
+ state : "updating" | "success" | "error" ;
36
+ updating : boolean ;
37
+ success : boolean ;
38
+ error : boolean ;
39
+ exception : Error | null ;
40
+ update : ( ) => void ;
41
+ }
42
+
43
+ declare module "vue/types/vue" {
44
+ // tslint:disable-next-line:interface-name
45
+ interface Vue {
46
+ $asyncComputed : { [ K : string ] : IASyncComputedState } ;
47
+ }
48
+ }
You can’t perform that action at this time.
0 commit comments