@luxass/utils 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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isNotNull$1 as isNotNull, isNotNullish$1 as isNotNullish, isNotUndefined$1 as isNotUndefined, isTruthy$1 as isTruthy } from "./guards.d-n1BzCANy.js";
2
2
  import { clamp$1 as clamp } from "./number.d-C2Xuq3Is.js";
3
3
  import { capitalize$1 as capitalize, dedent$1 as dedent, dedentRaw$1 as dedentRaw, formatStr$1 as formatStr, sanitizeIdentifier$1 as sanitizeIdentifier, toCamelCase$1 as toCamelCase, toKebabCase$1 as toKebabCase, toPascalCase$1 as toPascalCase, toSnakeCase$1 as toSnakeCase } from "./string.d-B2ppMtlR.js";
4
- import { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish } from "./types.d-BcKIY6l3.js";
4
+ import { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish, Prettify } from "./types.d-BqT_4t0N.js";
5
5
 
6
6
  //#region src/common.d.ts
7
7
  declare class InvariantError extends Error {
@@ -21,4 +21,4 @@ declare class InvariantError extends Error {
21
21
  declare function invariant(predicate: unknown, message: string, ...positionals: unknown[]): asserts predicate;
22
22
 
23
23
  //#endregion
24
- export { Arrayable, Awaitable, ElementOf, InferArguments, InvariantError, Nullable, Nullish, capitalize, clamp, dedent, dedentRaw, formatStr, invariant, isNotNull, isNotNullish, isNotUndefined, isTruthy, sanitizeIdentifier, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };
24
+ export { Arrayable, Awaitable, ElementOf, InferArguments, InvariantError, Nullable, Nullish, Prettify, capitalize, clamp, dedent, dedentRaw, formatStr, invariant, isNotNull, isNotNullish, isNotUndefined, isTruthy, sanitizeIdentifier, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };
@@ -68,5 +68,20 @@ type ElementOf<T> = T extends (infer E)[] ? E : never;
68
68
  */
69
69
  type InferArguments<T> = T extends ((...args: infer A) => any) ? A : never;
70
70
 
71
+ /**
72
+ * Makes complex nested types more readable in editor tooltips by flattening
73
+ * the type to a simple object type with all properties
74
+ * @param T - The type to prettify
75
+ * @returns A simplified representation of the same type
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * type Messy = { a: string } & { b: number } & { c: boolean }
80
+ * type Clean = Prettify<Messy>
81
+ * // { a: string; b: number; c: boolean }
82
+ * ```
83
+ */
84
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
85
+
71
86
  //#endregion
72
- export { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish };
87
+ export { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish, Prettify };
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish } from "./types.d-BcKIY6l3.js";
2
- export { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish };
1
+ import { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish, Prettify } from "./types.d-BqT_4t0N.js";
2
+ export { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish, Prettify };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/utils",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "A collection of utilities for JavaScript/TypeScript",
5
5
  "type": "module",
6
6
  "author": {