@jakubmazanec/ts-utils 3.0.4 → 3.0.5-unstable.91147a2
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/DeepReadonly.d.ts +1 -1
- package/build/types/Parameters.d.ts +1 -1
- package/build/types/Primitive.d.ts +1 -1
- package/build/types/ReturnType.d.ts +1 -1
- package/build/types/TupleToUnion.d.ts +1 -1
- package/build/types.d.ts +17 -17
- package/build/types.js +0 -17
- package/build/types.js.map +3 -3
- package/build/utils/tuple.d.ts +1 -1
- package/build/utils/tuple.js.map +1 -1
- package/package.json +3 -3
- package/source/types/DeepPartial.ts +1 -1
- package/source/types/DeepReadonly.ts +1 -1
- package/source/types/Parameters.ts +1 -1
- package/source/types/Primitive.ts +1 -1
- package/source/types/ReturnType.ts +1 -1
- package/source/types/TupleToUnion.ts +1 -1
- package/source/types.ts +17 -17
- package/source/utils/tuple.ts +2 -2
|
@@ -16,7 +16,7 @@ import { type Primitive } from './Primitive.js';
|
|
|
16
16
|
*
|
|
17
17
|
* @typeParam T Base for the new type
|
|
18
18
|
*/
|
|
19
|
-
export type DeepReadonly<T> = T extends
|
|
19
|
+
export type DeepReadonly<T> = T extends ((...args: any[]) => unknown) | Primitive ? T : T extends ReadonlyMap<infer K, infer V> ? DeepReadonlyMap<K, V> : T extends ReadonlySet<infer I> ? DeepReadonlySet<I> : T extends object ? DeepReadonlyObject<T> : unknown;
|
|
20
20
|
/**
|
|
21
21
|
* Helper type for {@link DeepReadonly}.
|
|
22
22
|
*/
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @typeParam T Base for the new type
|
|
16
16
|
*/
|
|
17
|
-
export type Parameters<T extends '' |
|
|
17
|
+
export type Parameters<T extends '' | ((...args: any[]) => any) | false | null | undefined> = T extends (...args: infer P) => any ? P : never;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @typeParam T Base for the new type
|
|
17
17
|
*/
|
|
18
|
-
export type ReturnType<T extends '' |
|
|
18
|
+
export type ReturnType<T extends '' | ((...args: any[]) => any) | false | null | undefined> = T extends (...args: any[]) => infer R ? R extends PromiseLike<infer J> ? J : R : never;
|
package/build/types.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * from './types/AtLeastOneRequired.js';
|
|
2
|
-
export * from './types/DeepPartial.js';
|
|
3
|
-
export * from './types/DeepReadonly.js';
|
|
4
|
-
export * from './types/If.js';
|
|
5
|
-
export * from './types/IsEqual.js';
|
|
6
|
-
export * from './types/LiteralUnion.js';
|
|
7
|
-
export * from './types/NonArray.js';
|
|
8
|
-
export * from './types/NonArrayLike.js';
|
|
9
|
-
export * from './types/OptionalKeys.js';
|
|
10
|
-
export * from './types/Parameters.js';
|
|
11
|
-
export * from './types/Primitive.js';
|
|
12
|
-
export * from './types/RequiredKeys.js';
|
|
13
|
-
export * from './types/ReturnType.js';
|
|
14
|
-
export * from './types/Simplify.js';
|
|
15
|
-
export * from './types/TupleToUnion.js';
|
|
16
|
-
export * from './types/UnionToIntersection.js';
|
|
17
|
-
export * from './types/Writable.js';
|
|
1
|
+
export type * from './types/AtLeastOneRequired.js';
|
|
2
|
+
export type * from './types/DeepPartial.js';
|
|
3
|
+
export type * from './types/DeepReadonly.js';
|
|
4
|
+
export type * from './types/If.js';
|
|
5
|
+
export type * from './types/IsEqual.js';
|
|
6
|
+
export type * from './types/LiteralUnion.js';
|
|
7
|
+
export type * from './types/NonArray.js';
|
|
8
|
+
export type * from './types/NonArrayLike.js';
|
|
9
|
+
export type * from './types/OptionalKeys.js';
|
|
10
|
+
export type * from './types/Parameters.js';
|
|
11
|
+
export type * from './types/Primitive.js';
|
|
12
|
+
export type * from './types/RequiredKeys.js';
|
|
13
|
+
export type * from './types/ReturnType.js';
|
|
14
|
+
export type * from './types/Simplify.js';
|
|
15
|
+
export type * from './types/TupleToUnion.js';
|
|
16
|
+
export type * from './types/UnionToIntersection.js';
|
|
17
|
+
export type * from './types/Writable.js';
|
package/build/types.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
export * from "./types/AtLeastOneRequired.js";
|
|
3
|
-
export * from "./types/DeepPartial.js";
|
|
4
|
-
export * from "./types/DeepReadonly.js";
|
|
5
|
-
export * from "./types/If.js";
|
|
6
|
-
export * from "./types/IsEqual.js";
|
|
7
|
-
export * from "./types/LiteralUnion.js";
|
|
8
|
-
export * from "./types/NonArray.js";
|
|
9
|
-
export * from "./types/NonArrayLike.js";
|
|
10
|
-
export * from "./types/OptionalKeys.js";
|
|
11
|
-
export * from "./types/Parameters.js";
|
|
12
|
-
export * from "./types/Primitive.js";
|
|
13
|
-
export * from "./types/RequiredKeys.js";
|
|
14
|
-
export * from "./types/ReturnType.js";
|
|
15
|
-
export * from "./types/Simplify.js";
|
|
16
|
-
export * from "./types/TupleToUnion.js";
|
|
17
|
-
export * from "./types/UnionToIntersection.js";
|
|
18
|
-
export * from "./types/Writable.js";
|
|
19
2
|
//# sourceMappingURL=types.js.map
|
package/build/types.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/utils/tuple.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type Primitive } from '../types.js';
|
|
2
|
-
export declare function tuple<T extends Array<
|
|
2
|
+
export declare function tuple<T extends Array<{} | Primitive>>(...values: T): T;
|
package/build/utils/tuple.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../source/utils/tuple.ts"],
|
|
4
|
-
"sourcesContent": ["import {type Primitive} from '../types.js';\n\n// eslint-disable-next-line @typescript-eslint/
|
|
4
|
+
"sourcesContent": ["import {type Primitive} from '../types.js';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- this is intended\nexport function tuple<T extends Array<{} | Primitive>>(...values: T) {\n return values;\n}\n"],
|
|
5
5
|
"mappings": ";AAGO,gBAAS,SAA0C,QAAW;AACnE,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jakubmazanec/ts-utils",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5-unstable.91147a2",
|
|
4
4
|
"description": "Collection of TypeScript types and utilities.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"typecheck": "tsc --project tsconfig.typecheck.json"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@jakubmazanec/eslint-config": "
|
|
30
|
+
"@jakubmazanec/eslint-config": "4.0.0-unstable.91147a2",
|
|
31
31
|
"@types/lodash": "^4.17.13",
|
|
32
32
|
"@types/node": "^22.9.0",
|
|
33
33
|
"@vitest/coverage-v8": "^2.1.4",
|
|
34
34
|
"concurrently": "^9.1.0",
|
|
35
35
|
"del-cli": "^6.0.0",
|
|
36
36
|
"esbuild": "^0.24.0",
|
|
37
|
-
"eslint": "^
|
|
37
|
+
"eslint": "^9.14.0",
|
|
38
38
|
"lodash": "^4.17.21",
|
|
39
39
|
"prettier": "^3.3.3",
|
|
40
40
|
"prettier-plugin-packagejson": "^2.5.3",
|
|
@@ -20,7 +20,7 @@ import {type Primitive} from './Primitive.js';
|
|
|
20
20
|
* @typeParam T Base for the new type
|
|
21
21
|
*/
|
|
22
22
|
export type DeepReadonly<T> =
|
|
23
|
-
T extends
|
|
23
|
+
T extends ((...args: any[]) => unknown) | Primitive ? T
|
|
24
24
|
: T extends ReadonlyMap<infer K, infer V> ? DeepReadonlyMap<K, V>
|
|
25
25
|
: T extends ReadonlySet<infer I> ? DeepReadonlySet<I>
|
|
26
26
|
: T extends object ? DeepReadonlyObject<T>
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @typeParam T Base for the new type
|
|
18
18
|
*/
|
|
19
|
-
export type Parameters<T extends '' |
|
|
19
|
+
export type Parameters<T extends '' | ((...args: any[]) => any) | false | null | undefined> =
|
|
20
20
|
T extends (...args: infer P) => any ? P : never;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @typeParam T Base for the new type
|
|
19
19
|
*/
|
|
20
|
-
export type ReturnType<T extends '' |
|
|
20
|
+
export type ReturnType<T extends '' | ((...args: any[]) => any) | false | null | undefined> =
|
|
21
21
|
T extends (...args: any[]) => infer R ?
|
|
22
22
|
R extends PromiseLike<infer J> ?
|
|
23
23
|
J
|
package/source/types.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * from './types/AtLeastOneRequired.js';
|
|
2
|
-
export * from './types/DeepPartial.js';
|
|
3
|
-
export * from './types/DeepReadonly.js';
|
|
4
|
-
export * from './types/If.js';
|
|
5
|
-
export * from './types/IsEqual.js';
|
|
6
|
-
export * from './types/LiteralUnion.js';
|
|
7
|
-
export * from './types/NonArray.js';
|
|
8
|
-
export * from './types/NonArrayLike.js';
|
|
9
|
-
export * from './types/OptionalKeys.js';
|
|
10
|
-
export * from './types/Parameters.js';
|
|
11
|
-
export * from './types/Primitive.js';
|
|
12
|
-
export * from './types/RequiredKeys.js';
|
|
13
|
-
export * from './types/ReturnType.js';
|
|
14
|
-
export * from './types/Simplify.js';
|
|
15
|
-
export * from './types/TupleToUnion.js';
|
|
16
|
-
export * from './types/UnionToIntersection.js';
|
|
17
|
-
export * from './types/Writable.js';
|
|
1
|
+
export type * from './types/AtLeastOneRequired.js';
|
|
2
|
+
export type * from './types/DeepPartial.js';
|
|
3
|
+
export type * from './types/DeepReadonly.js';
|
|
4
|
+
export type * from './types/If.js';
|
|
5
|
+
export type * from './types/IsEqual.js';
|
|
6
|
+
export type * from './types/LiteralUnion.js';
|
|
7
|
+
export type * from './types/NonArray.js';
|
|
8
|
+
export type * from './types/NonArrayLike.js';
|
|
9
|
+
export type * from './types/OptionalKeys.js';
|
|
10
|
+
export type * from './types/Parameters.js';
|
|
11
|
+
export type * from './types/Primitive.js';
|
|
12
|
+
export type * from './types/RequiredKeys.js';
|
|
13
|
+
export type * from './types/ReturnType.js';
|
|
14
|
+
export type * from './types/Simplify.js';
|
|
15
|
+
export type * from './types/TupleToUnion.js';
|
|
16
|
+
export type * from './types/UnionToIntersection.js';
|
|
17
|
+
export type * from './types/Writable.js';
|
package/source/utils/tuple.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {type Primitive} from '../types.js';
|
|
2
2
|
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
4
|
-
export function tuple<T extends Array<
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- this is intended
|
|
4
|
+
export function tuple<T extends Array<{} | Primitive>>(...values: T) {
|
|
5
5
|
return values;
|
|
6
6
|
}
|