@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.
@@ -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 Primitive | ((...args: any[]) => unknown) ? T : T extends ReadonlyMap<infer K, infer V> ? DeepReadonlyMap<K, V> : T extends ReadonlySet<infer I> ? DeepReadonlySet<I> : T extends object ? DeepReadonlyObject<T> : unknown;
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 '' | false | ((...args: any[]) => any) | null | undefined> = T extends (...args: infer P) => any ? P : never;
17
+ export type Parameters<T extends '' | ((...args: any[]) => any) | false | null | undefined> = T extends (...args: infer P) => any ? P : never;
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Union of primitive types.
3
3
  */
4
- export type Primitive = bigint | boolean | number | string | symbol | null | undefined;
4
+ export type Primitive = bigint | boolean | null | number | string | symbol | undefined;
@@ -15,4 +15,4 @@
15
15
  *
16
16
  * @typeParam T Base for the new type
17
17
  */
18
- export type ReturnType<T extends '' | false | ((...args: any[]) => any) | null | undefined> = T extends (...args: any[]) => infer R ? R extends PromiseLike<infer J> ? J : R : never;
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;
@@ -7,4 +7,4 @@
7
7
  *
8
8
  * @typeParam T Base for the new type.
9
9
  */
10
- export type TupleToUnion<T extends unknown[] | readonly unknown[]> = T[number];
10
+ export type TupleToUnion<T extends readonly unknown[] | unknown[]> = T[number];
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../source/types.ts"],
4
- "sourcesContent": ["export * from './types/AtLeastOneRequired.js';\nexport * from './types/DeepPartial.js';\nexport * from './types/DeepReadonly.js';\nexport * from './types/If.js';\nexport * from './types/IsEqual.js';\nexport * from './types/LiteralUnion.js';\nexport * from './types/NonArray.js';\nexport * from './types/NonArrayLike.js';\nexport * from './types/OptionalKeys.js';\nexport * from './types/Parameters.js';\nexport * from './types/Primitive.js';\nexport * from './types/RequiredKeys.js';\nexport * from './types/ReturnType.js';\nexport * from './types/Simplify.js';\nexport * from './types/TupleToUnion.js';\nexport * from './types/UnionToIntersection.js';\nexport * from './types/Writable.js';\n"],
5
- "mappings": ";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
1
  import { type Primitive } from '../types.js';
2
- export declare function tuple<T extends Array<Primitive | {}>>(...values: T): T;
2
+ export declare function tuple<T extends Array<{} | Primitive>>(...values: T): T;
@@ -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/ban-types -- this is intended\nexport function tuple<T extends Array<Primitive | {}>>(...values: T) {\n return values;\n}\n"],
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.4",
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": "^3.2.0",
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": "^8.56.0",
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",
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-interface -- needed */
1
+ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type -- needed */
2
2
 
3
3
  import {type Primitive} from './Primitive.js';
4
4
 
@@ -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 Primitive | ((...args: any[]) => unknown) ? T
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 '' | false | ((...args: any[]) => any) | null | undefined> =
19
+ export type Parameters<T extends '' | ((...args: any[]) => any) | false | null | undefined> =
20
20
  T extends (...args: infer P) => any ? P : never;
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Union of primitive types.
3
3
  */
4
- export type Primitive = bigint | boolean | number | string | symbol | null | undefined;
4
+ export type Primitive = bigint | boolean | null | number | string | symbol | undefined;
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * @typeParam T Base for the new type
19
19
  */
20
- export type ReturnType<T extends '' | false | ((...args: any[]) => any) | null | undefined> =
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
@@ -7,4 +7,4 @@
7
7
  *
8
8
  * @typeParam T Base for the new type.
9
9
  */
10
- export type TupleToUnion<T extends unknown[] | readonly unknown[]> = T[number];
10
+ export type TupleToUnion<T extends readonly unknown[] | unknown[]> = T[number];
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';
@@ -1,6 +1,6 @@
1
1
  import {type Primitive} from '../types.js';
2
2
 
3
- // eslint-disable-next-line @typescript-eslint/ban-types -- this is intended
4
- export function tuple<T extends Array<Primitive | {}>>(...values: T) {
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
  }