@@ -45,13 +45,13 @@ declare global {
45
45
type Maybe < T > = T | undefined ;
46
46
47
47
/**
48
- * Represents a value that can be of type `T` or a Promise that resolves to `T`.
48
+ * Represents a value that can be of type `T` or a Promise that resolves to `T`.
49
49
* A more idiomatic name for `MaybePromise`.
50
50
* @template T The type of the value.
51
51
* @example
52
52
* async function process(data: Awaitable<string>) {
53
- * const resolvedData = await data;
54
- * console.log(resolvedData);
53
+ * const resolvedData = await data;
54
+ * console.log(resolvedData);
55
55
* }
56
56
*/
57
57
type Awaitable < T > = T | Promise < T > ;
@@ -61,8 +61,8 @@ declare global {
61
61
* @template T The type of the item(s).
62
62
* @example
63
63
* function logItems(items: SingleOrArray<string>) {
64
- * const allItems = Array.isArray(items) ? items : [items];
65
- * allItems.forEach(item => console.log(item));
64
+ * const allItems = Array.isArray(items) ? items : [items];
65
+ * allItems.forEach(item => console.log(item));
66
66
* }
67
67
*/
68
68
type SingleOrArray < T > = T | T [ ] ;
@@ -77,7 +77,6 @@ declare global {
77
77
78
78
/**
79
79
* Returns the keys of an object type `T` that are required (not optional).
80
- *
81
80
* @template T - The object type.
82
81
* @returns The keys of `T` that are required.
83
82
*/
@@ -87,7 +86,6 @@ declare global {
87
86
88
87
/**
89
88
* Returns the keys of an object type `T` that are optional.
90
- *
91
89
* @template T - The object type.
92
90
* @returns The keys of `T` that are optional.
93
91
*/
@@ -121,7 +119,6 @@ declare global {
121
119
122
120
/**
123
121
* Recursively makes all properties of an object and its nested objects/array required.
124
- *
125
122
* @template T - The type to make deep required.
126
123
* @param {T } value - The value to make deep required.
127
124
* @returns {DeepRequired<T> } - The deep required type.
@@ -184,7 +181,7 @@ declare global {
184
181
type ObjectValues < T > = T [ keyof T ] ;
185
182
186
183
/**
187
- * Extracts the item type from an array (including readonly arrays).
184
+ * Extracts the item type from an array (including readonly arrays).
188
185
* Returns `never` if `T` is not an array.
189
186
* @template T The array type.
190
187
* @example
@@ -204,6 +201,14 @@ declare global {
204
201
*/
205
202
type Overwrite < M , N > = Omit < M , keyof N > & N ;
206
203
204
+ /**
205
+ * Flattens a complex type into a simple object representation (بکش از ما بیرون).
206
+ * Useful for improving editor tooltips for complex intersection and mapped types.
207
+ * And also to transform an interface into a type to aide with assignability.
208
+ * @template T The type to simplify.
209
+ */
210
+ type Simplify < T > = { [ K in keyof T ] : T [ K ] } & { } ;
211
+
207
212
/**
208
213
* Make all properties in T required and exclude undefined and null from the property type.
209
214
*/
@@ -287,13 +292,5 @@ declare global {
287
292
[ Key in keyof Pick < T , FilterJsonifiableKeys < T > > ] : T [ Key ] ;
288
293
} ;
289
294
290
- /**
291
- * Convert simple type (بکش از ما بیرون).
292
- * Useful to flatten the type output to improve type hints shown in editors.
293
- * And also to transform an interface into a type to aide with assignability.
294
- *
295
- * @template T - The type to be simplified.
296
- * @returns The simplified type.
297
- */
298
- type Simplify < T > = { [ KeyType in keyof T ] : T [ KeyType ] } & { } ;
295
+
299
296
}
0 commit comments