@esportsplus/typescript 0.0.2 → 0.0.4
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/build/types.d.ts +3 -7
- package/package.json +6 -2
- package/src/types.ts +11 -8
package/build/types.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
type
|
|
2
|
-
[K in keyof T as T[K] extends Function ? K : never]: T[K];
|
|
3
|
-
};
|
|
4
|
-
type Mutable<T> = {
|
|
5
|
-
-readonly [P in keyof T]: T[P];
|
|
6
|
-
};
|
|
1
|
+
type Function = (...args: unknown[]) => Promise<unknown> | unknown;
|
|
7
2
|
type Prettify<T> = {
|
|
8
3
|
[K in keyof T]: T[K];
|
|
9
4
|
} & {};
|
|
10
|
-
|
|
5
|
+
type SyncFunction<T, R = T extends Function ? ReturnType<T> : T> = T extends Promise<unknown> ? never : T extends Function ? SyncFunction<R> extends never ? never : T : T;
|
|
6
|
+
export { Prettify, SyncFunction };
|
package/package.json
CHANGED
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
},
|
|
7
7
|
"exports": {
|
|
8
8
|
"./package.json": "./package.json",
|
|
9
|
-
"./tsconfig.base.json": "./tsconfig.base.json"
|
|
9
|
+
"./tsconfig.base.json": "./tsconfig.base.json",
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./build/index.d.ts",
|
|
12
|
+
"default": "./build/index.js"
|
|
13
|
+
}
|
|
10
14
|
},
|
|
11
15
|
"main": "build/index.js",
|
|
12
16
|
"name": "@esportsplus/typescript",
|
|
@@ -18,5 +22,5 @@
|
|
|
18
22
|
"prepublishOnly": "npm run build"
|
|
19
23
|
},
|
|
20
24
|
"types": "build/index.d.ts",
|
|
21
|
-
"version": "0.0.
|
|
25
|
+
"version": "0.0.4"
|
|
22
26
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
type
|
|
2
|
-
[K in keyof T as T[K] extends Function ? K : never]: T[K]
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
type Mutable<T> = {
|
|
6
|
-
-readonly [P in keyof T]: T[P];
|
|
7
|
-
};
|
|
1
|
+
type Function = (...args: unknown[]) => Promise<unknown> | unknown;
|
|
8
2
|
|
|
9
3
|
type Prettify<T> = {
|
|
10
4
|
[K in keyof T]: T[K];
|
|
11
5
|
} & {};
|
|
12
6
|
|
|
7
|
+
type SyncFunction<T, R = T extends Function ? ReturnType<T> : T> =
|
|
8
|
+
T extends Promise<unknown>
|
|
9
|
+
? never
|
|
10
|
+
: T extends Function
|
|
11
|
+
? SyncFunction<R> extends never
|
|
12
|
+
? never
|
|
13
|
+
: T
|
|
14
|
+
: T;
|
|
15
|
+
|
|
13
16
|
|
|
14
|
-
export {
|
|
17
|
+
export { Prettify, SyncFunction };
|