ts-gems 2.1.0 → 2.2.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/common.d.ts +17 -2
- package/package.json +4 -4
package/lib/common.d.ts
CHANGED
|
@@ -68,11 +68,11 @@ export type ElementType<T extends { [P in K & any]: any },
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* Type
|
|
72
72
|
* @desc Represents constructor of type T
|
|
73
73
|
*/
|
|
74
74
|
export interface Type<T = any> {
|
|
75
|
-
|
|
75
|
+
new(...args: any[]): T;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
@@ -81,3 +81,18 @@ export interface Type<T = any> {
|
|
|
81
81
|
*/
|
|
82
82
|
export type Class<Args extends any[] = any[], Instance = {}, Static = {}> =
|
|
83
83
|
(new(...args: Args) => Instance) & Static;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* NoUnion
|
|
87
|
+
* @desc Returns "never" if the type is union
|
|
88
|
+
*/
|
|
89
|
+
type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Opaque
|
|
94
|
+
* @desc Create unique type that can't be assigned to base type by accident.
|
|
95
|
+
*/
|
|
96
|
+
type Opaque<T, N extends string> = T & {
|
|
97
|
+
__type: N;
|
|
98
|
+
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"lodash",
|
|
13
13
|
"underscore"
|
|
14
14
|
],
|
|
15
|
-
"version": "2.
|
|
15
|
+
"version": "2.2.0",
|
|
16
16
|
"types": "lib/index.d.ts",
|
|
17
17
|
"repository": "git@github.com:panates/ts-gems.git",
|
|
18
18
|
"author": "Eray Hanoglu <e.hanoglu@panates.com>",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"typescript": ">=4.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/jest": "^28.1.
|
|
37
|
-
"eslint": "^8.
|
|
38
|
-
"jest": "^28.1.
|
|
36
|
+
"@types/jest": "^28.1.4",
|
|
37
|
+
"eslint": "^8.19.0",
|
|
38
|
+
"jest": "^28.1.2",
|
|
39
39
|
"ts-jest": "^28.0.5",
|
|
40
40
|
"typescript": "^4.7.4"
|
|
41
41
|
}
|