@mirohq/design-system-types 1.0.1-dummy.0 → 1.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/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @mirohq-internal/design-system-types
2
2
 
3
- ## 1.0.1-dummy.0
3
+ ## 1.0.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [`e5a9653ef`](https://github.com/miroapp-dev/design-system/commit/e5a9653efd52994bcc4e6ac76705cd093bfaaa96) Thanks [@ivanbanov](https://github.com/ivanbanov)! - dummy
7
+ - [#1184](https://github.com/miroapp-dev/design-system/pull/1184) [`5023b24bd`](https://github.com/miroapp-dev/design-system/commit/5023b24bda56843d874622b290c9b84ce326c604) Thanks [@ivanbanov](https://github.com/ivanbanov)! - Fix ButtonProps types and make usage as link to work properly.
8
8
 
9
9
  ## 1.0.0
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-types",
3
- "version": "1.0.1-dummy.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "types": "src/index.d.ts",
package/src/global.d.ts CHANGED
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Makes a type more readable in editor tooltips by flattening intersections.
3
+ * @example
4
+ * type Result = Pretty<{a: number} & {b: string}>
5
+ * { a: number; b: string }
6
+ */
7
+ export type Pretty<T> = { [K in keyof T]: T[K] } & {}
8
+
1
9
  /**
2
10
  * Convert a type into a union of the value itself with null and undefined.
3
11
  *
@@ -9,6 +17,14 @@
9
17
  */
10
18
  export type Nullable<T> = T | null | undefined
11
19
 
20
+ /**
21
+ * Assigns properties from U to T, overwriting T's properties with U's if they overlap.
22
+ * @example
23
+ * type Result = Assign<{a: 1, b: 2}, {b: 3, c: 4}>
24
+ * // { a: 1; b: 3; c: 4 }
25
+ */
26
+ export type Assign<T, U> = Pretty<Omit<T, keyof U> & U>
27
+
12
28
  /**
13
29
  * A type that can be a number or a string representation of a number.
14
30
  *
@@ -75,6 +91,19 @@ export type MergeUnion<T, U> = {
75
91
  [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]
76
92
  } & OmitFromUnion<U, keyof T>
77
93
 
94
+ /**
95
+ * Adds properties from an object type to all members of a union type.
96
+ *
97
+ * @example
98
+ * Add properties to all union members
99
+ *
100
+ * type Union = { foo: number } | { bar: string }
101
+ * type Foo = { id: number }
102
+ * type Result = AddToUnion<Union, Foo>
103
+ * { foo: number, id: number } | { bar: string, id: number }
104
+ */
105
+ export type AddToUnion<T, U> = T extends any ? Assign<T, U> : never
106
+
78
107
  /**
79
108
  * Convert a type into a union of the value itself and an array of the value.
80
109
  *