Skip to content

Commit ebcab8a

Browse files
committed
🔧 upgrade TS configuration
1 parent e87a4a2 commit ebcab8a

File tree

5 files changed

+16
-33
lines changed

5 files changed

+16
-33
lines changed

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compilerOptions": {
33
"strict": true,
4-
"target": "es2018",
5-
"lib": ["es2018", "dom"],
4+
"target": "esnext",
5+
"lib": ["esnext", "dom"],
66

77
// Module configuration.
88
"moduleResolution": "node",

types/LoadableMixin.d.ts

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,4 @@
11
import Vue from 'vue';
2-
export declare type LoadableMixinInstance = Vue & LoadableMixinState & LoadableMixinMethods;
3-
export declare type LoadableMixinState = {
4-
LOADING_STATES: Record<string, number>;
5-
};
6-
export declare type LoadableMixinMethods = {
7-
/**
8-
* Check if a state is loading.
9-
* @param [state] - Loading state name.
10-
*/
11-
$isLoading(this: LoadableMixinInstance, state?: string): boolean;
12-
/**
13-
* Check if any state is loading.
14-
*/
15-
$isLoadingAny(this: LoadableMixinInstance): boolean;
16-
/**
17-
* Set state as loading.
18-
* @param [state] - Loading state name.
19-
*/
20-
$setLoading(this: LoadableMixinInstance, state?: string): void;
21-
/**
22-
* Unset state as loading.
23-
* @param [state] - Loading state name.
24-
*/
25-
$unsetLoading(this: LoadableMixinInstance, state?: string): void;
26-
};
272
/**
283
* A mixin which adds loading states and helpers to Vue components.
294
* @example ```js
@@ -36,5 +11,12 @@ export declare type LoadableMixinMethods = {
3611
* }
3712
* })```
3813
*/
39-
declare const LoadableMixin: import("vue").VueConstructor<LoadableMixinState & LoadableMixinMethods & Record<never, any> & Vue>;
14+
declare const LoadableMixin: import("vue").VueConstructor<{
15+
LOADING_STATES: Record<string, number>;
16+
} & {
17+
$isLoading(state?: string): boolean;
18+
$isLoadingAny(): boolean;
19+
$setLoading(state?: string): void;
20+
$unsetLoading(state?: string): void;
21+
} & Record<never, any> & Vue>;
4022
export default LoadableMixin;

types/callWithHooks.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
* @param onDone
66
* @param onError
77
*/
8-
export default function callWithHooks<T>(call: () => T | Promise<T>, onDone: () => void, onError?: () => void): Promise<T>;
8+
declare const callWithHooks: <T>(call: () => T | Promise<T>, onDone: () => void, onError?: () => void) => Promise<T>;
9+
export default callWithHooks;

types/loadable.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { LoadableMixinInstance } from './LoadableMixin';
1+
import Vue from 'vue';
22
/**
33
* An union of any function and functions that have access to `this`
44
* (Vue instance).
55
*/
6-
export declare type Method = ((...args: any[]) => any) | ((this: LoadableMixinInstance, ...args: any[]) => any);
6+
export declare type Method = ((...args: any[]) => any) | ((this: Vue, ...args: any[]) => any);
77
/**
88
* A Higher-order type to trasnform a method into loadable method that have
99
* access to `this` (Vue instance) and returns a Promise.
1010
*/
11-
export declare type LoadableMethod<T extends Method> = (this: LoadableMixinInstance, ...args: Parameters<T>) => ReturnType<T> extends Promise<any> ? ReturnType<T> : Promise<ReturnType<T>>;
11+
export declare type LoadableMethod<T extends Method> = (this: Vue, ...args: Parameters<T>) => ReturnType<T> extends Promise<any> ? ReturnType<T> : Promise<ReturnType<T>>;
1212
/**
1313
* Decorate a method to causes loading states changes during its execution. It
1414
* sets state as loading when function is init and unsets on throws an error or

types/vue-loadable.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ declare module 'vue/types/vue' {
2525
}
2626
export { LoadableMixin };
2727
export { default as loadable, Method, LoadableMethod } from './loadable';
28-
export { default as mapLoadableMethods, Methods, LoadableMethods } from './mapLoadableMethods';
28+
export { default as mapLoadableMethods, Methods, LoadableMethods, } from './mapLoadableMethods';
2929
/**
3030
* Installs LoadableMixin globally.
3131
* @example ```js

0 commit comments

Comments
 (0)