@codeleap/types 4.3.9 → 5.0.1
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/package.json +4 -4
- package/package.json.bak +3 -3
- package/src/typeGuards.ts +4 -0
- package/src/utility.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"directory": "packages/types"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/config": "
|
|
12
|
+
"@codeleap/config": "5.0.1",
|
|
13
13
|
"ts-node-dev": "1.1.8"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "echo 'No build needed'"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"typescript": "5.
|
|
20
|
-
"react": "18.
|
|
19
|
+
"typescript": "5.5.2",
|
|
20
|
+
"react": "18.2.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"build": "echo 'No build needed'"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"typescript": "5.
|
|
20
|
-
"react": "18.
|
|
19
|
+
"typescript": "5.5.2",
|
|
20
|
+
"react": "18.2.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/src/typeGuards.ts
CHANGED
|
@@ -55,3 +55,7 @@ export function isElement(x): x is React.ReactElement {
|
|
|
55
55
|
export function isComponentOrElement<P>(x: any): x is React.ComponentType<P> | React.ReactElement {
|
|
56
56
|
return isFunction(x) || isElement(x)
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
export function isPromise(x): x is Promise<any> {
|
|
60
|
+
return isFunction(x?.then) && isFunction(x?.catch)
|
|
61
|
+
}
|
package/src/utility.ts
CHANGED
|
@@ -116,3 +116,9 @@ export type Replace<Object, Keys extends keyof Object, With = any> = Omit<Object
|
|
|
116
116
|
export type Matcher<T> = string | Partial<RegExp> | FunctionType<[valueOrKey: any, type: T], boolean>
|
|
117
117
|
|
|
118
118
|
export type LogType = 'info' | 'debug' | 'warn' | 'error' | 'log' | 'silent'
|
|
119
|
+
|
|
120
|
+
export type SecondToLastArguments<T extends AnyFunction> = T extends ((...args: [infer _, ...infer Rest]) => any) ? Rest : never
|
|
121
|
+
|
|
122
|
+
export type Options<T> = { label: string; value: T }[]
|
|
123
|
+
|
|
124
|
+
export type Option<T> = Options<T>[number]
|