File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 44 "description" : " Async computed properties for Vue" ,
55 "main" : " dist/vue-async-computed.js" ,
66 "module" : " dist/vue-async-computed.esm.js" ,
7+ "types" : " types/index.d.ts" ,
78 "files" : [
89 " bin/" ,
910 " 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+ default ?: any ;
7+ }
8+
9+ export default class AsyncComputed {
10+ constructor ( options ?: IAsyncComputedOptions ) ;
11+ static install : PluginFunction < never > ;
12+ static version : string ;
13+ }
14+
15+ type AsyncComputedGetter < T > = ( ) => Promise < T > ;
16+ interface IAsyncComputedValue < T > {
17+ default ?: T | ( ( ) => T ) ;
18+ get : AsyncComputedGetter < T > ;
19+ watch ?: ( ) => void ;
20+ shouldUpdate ?: ( ) => boolean ;
21+ lazy ?: boolean ;
22+ }
23+
24+ interface AsyncComputedObject {
25+ [ K : string ] : AsyncComputedGetter < any > | IAsyncComputedValue < any > ;
26+ }
27+
28+ declare module "vue/types/options" {
29+ interface ComponentOptions < V extends Vue > {
30+ asyncComputed ?: AsyncComputedObject ;
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+ interface Vue {
45+ $asyncComputed : { [ K : string ] : IASyncComputedState } ;
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments