@infra-blocks/types 0.17.0-alpha.1 → 0.18.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/func.d.ts +18 -14
- package/lib/esm/func.d.ts +18 -14
- package/package.json +2 -1
package/lib/cjs/func.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The async flavor of {@link Factory}.
|
|
3
|
+
*/
|
|
4
|
+
export type AsyncFactory<P extends unknown[], R> = (...params: P) => Promise<R>;
|
|
5
|
+
/**
|
|
6
|
+
* A type alias for asynchronous provider functions.
|
|
7
|
+
*/
|
|
8
|
+
export type AsyncProvider<T> = () => Promise<T>;
|
|
1
9
|
/**
|
|
2
10
|
* Convenient type to easily represent "callable" types and to avoid using
|
|
3
11
|
* "any" in client code.
|
|
@@ -8,26 +16,22 @@ export type Callable = (...args: never[]) => unknown;
|
|
|
8
16
|
*/
|
|
9
17
|
export type Constructor<R = object, A extends any[] = any[]> = new (...args: A) => R;
|
|
10
18
|
/**
|
|
11
|
-
* A type
|
|
12
|
-
*/
|
|
13
|
-
export type Predicate<T> = (item: T) => boolean;
|
|
14
|
-
/**
|
|
15
|
-
* A type alias for functions that return a value of a given type without arguments.
|
|
16
|
-
*/
|
|
17
|
-
export type Provider<T> = () => T;
|
|
18
|
-
/**
|
|
19
|
-
* A type alias for asynchronous provider functions.
|
|
19
|
+
* A convenient type declaration for handlers used to resolve "error" type events.
|
|
20
20
|
*/
|
|
21
|
-
export type
|
|
21
|
+
export type ErrorHandler<T extends Error = Error> = (err: T) => void;
|
|
22
22
|
/**
|
|
23
23
|
* A type alias for a function that creates objects of a given type.
|
|
24
24
|
*/
|
|
25
25
|
export type Factory<P extends unknown[], R> = (...params: P) => R;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* A type alias for single element predicate functions.
|
|
28
28
|
*/
|
|
29
|
-
export type
|
|
29
|
+
export type Predicate<T> = (item: T) => boolean;
|
|
30
30
|
/**
|
|
31
|
-
* A
|
|
31
|
+
* A type alias for functions that return a value of a given type without arguments.
|
|
32
32
|
*/
|
|
33
|
-
export type
|
|
33
|
+
export type Provider<T> = () => T;
|
|
34
|
+
/**
|
|
35
|
+
* A type alias for type guards.
|
|
36
|
+
*/
|
|
37
|
+
export type TypeGuard<T extends V, V = unknown> = (value: V) => value is T;
|
package/lib/esm/func.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The async flavor of {@link Factory}.
|
|
3
|
+
*/
|
|
4
|
+
export type AsyncFactory<P extends unknown[], R> = (...params: P) => Promise<R>;
|
|
5
|
+
/**
|
|
6
|
+
* A type alias for asynchronous provider functions.
|
|
7
|
+
*/
|
|
8
|
+
export type AsyncProvider<T> = () => Promise<T>;
|
|
1
9
|
/**
|
|
2
10
|
* Convenient type to easily represent "callable" types and to avoid using
|
|
3
11
|
* "any" in client code.
|
|
@@ -8,26 +16,22 @@ export type Callable = (...args: never[]) => unknown;
|
|
|
8
16
|
*/
|
|
9
17
|
export type Constructor<R = object, A extends any[] = any[]> = new (...args: A) => R;
|
|
10
18
|
/**
|
|
11
|
-
* A type
|
|
12
|
-
*/
|
|
13
|
-
export type Predicate<T> = (item: T) => boolean;
|
|
14
|
-
/**
|
|
15
|
-
* A type alias for functions that return a value of a given type without arguments.
|
|
16
|
-
*/
|
|
17
|
-
export type Provider<T> = () => T;
|
|
18
|
-
/**
|
|
19
|
-
* A type alias for asynchronous provider functions.
|
|
19
|
+
* A convenient type declaration for handlers used to resolve "error" type events.
|
|
20
20
|
*/
|
|
21
|
-
export type
|
|
21
|
+
export type ErrorHandler<T extends Error = Error> = (err: T) => void;
|
|
22
22
|
/**
|
|
23
23
|
* A type alias for a function that creates objects of a given type.
|
|
24
24
|
*/
|
|
25
25
|
export type Factory<P extends unknown[], R> = (...params: P) => R;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* A type alias for single element predicate functions.
|
|
28
28
|
*/
|
|
29
|
-
export type
|
|
29
|
+
export type Predicate<T> = (item: T) => boolean;
|
|
30
30
|
/**
|
|
31
|
-
* A
|
|
31
|
+
* A type alias for functions that return a value of a given type without arguments.
|
|
32
32
|
*/
|
|
33
|
-
export type
|
|
33
|
+
export type Provider<T> = () => T;
|
|
34
|
+
/**
|
|
35
|
+
* A type alias for type guards.
|
|
36
|
+
*/
|
|
37
|
+
export type TypeGuard<T extends V, V = unknown> = (value: V) => value is T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infra-blocks/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0-alpha.0",
|
|
4
4
|
"description": "Typescript types utility package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"type",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
|
44
44
|
"@typescript-eslint/parser": "^5.59.8",
|
|
45
45
|
"c8": "^8.0.0",
|
|
46
|
+
"conditional-type-checks": "^1.0.6",
|
|
46
47
|
"eslint": "^8.41.0",
|
|
47
48
|
"eslint-config-prettier": "^8.8.0",
|
|
48
49
|
"eslint-plugin-json-format": "^2.0.1",
|