type-fest 2.5.3 → 2.8.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.
Files changed (65) hide show
  1. package/index.d.ts +12 -0
  2. package/license +1 -9
  3. package/package.json +1 -1
  4. package/readme.md +37 -15
  5. package/source/async-return-type.d.ts +1 -1
  6. package/source/asyncify.d.ts +1 -1
  7. package/source/basic.d.ts +6 -6
  8. package/source/camel-case.d.ts +2 -1
  9. package/source/camel-cased-properties-deep.d.ts +3 -1
  10. package/source/camel-cased-properties.d.ts +3 -1
  11. package/source/conditional-except.d.ts +1 -1
  12. package/source/conditional-keys.d.ts +1 -1
  13. package/source/conditional-pick.d.ts +1 -1
  14. package/source/delimiter-case.d.ts +5 -2
  15. package/source/delimiter-cased-properties-deep.d.ts +3 -1
  16. package/source/delimiter-cased-properties.d.ts +3 -1
  17. package/source/entries.d.ts +4 -1
  18. package/source/entry.d.ts +4 -1
  19. package/source/except.d.ts +1 -1
  20. package/source/fixed-length-array.d.ts +1 -1
  21. package/source/get.d.ts +3 -1
  22. package/source/includes.d.ts +1 -1
  23. package/source/iterable-element.d.ts +1 -1
  24. package/source/join.d.ts +2 -1
  25. package/source/jsonify.d.ts +1 -1
  26. package/source/kebab-case.d.ts +2 -1
  27. package/source/kebab-cased-properties-deep.d.ts +3 -1
  28. package/source/kebab-cased-properties.d.ts +3 -1
  29. package/source/last-array-element.d.ts +2 -1
  30. package/source/literal-union.d.ts +1 -1
  31. package/source/merge-exclusive.d.ts +1 -1
  32. package/source/merge.d.ts +1 -1
  33. package/source/multidimensional-array.d.ts +1 -1
  34. package/source/multidimensional-readonly-array.d.ts +1 -1
  35. package/source/mutable.d.ts +1 -1
  36. package/source/numeric.d.ts +168 -0
  37. package/source/observable-like.d.ts +15 -1
  38. package/source/opaque.d.ts +1 -1
  39. package/source/package-json.d.ts +1 -1
  40. package/source/partial-deep.d.ts +4 -1
  41. package/source/pascal-case.d.ts +2 -1
  42. package/source/pascal-cased-properties-deep.d.ts +3 -1
  43. package/source/pascal-cased-properties.d.ts +3 -1
  44. package/source/primitive.d.ts +1 -1
  45. package/source/promisable.d.ts +2 -2
  46. package/source/promise-value.d.ts +3 -1
  47. package/source/readonly-deep.d.ts +4 -1
  48. package/source/require-all-or-none.d.ts +1 -1
  49. package/source/require-at-least-one.d.ts +1 -1
  50. package/source/require-exactly-one.d.ts +1 -1
  51. package/source/screaming-snake-case.d.ts +2 -1
  52. package/source/set-optional.d.ts +1 -1
  53. package/source/set-required.d.ts +1 -1
  54. package/source/set-return-type.d.ts +1 -1
  55. package/source/simplify.d.ts +1 -1
  56. package/source/snake-case.d.ts +2 -1
  57. package/source/snake-cased-properties-deep.d.ts +3 -1
  58. package/source/snake-cased-properties.d.ts +3 -1
  59. package/source/split.d.ts +2 -1
  60. package/source/stringified.d.ts +1 -1
  61. package/source/trim.d.ts +2 -1
  62. package/source/tsconfig-json.d.ts +3 -1
  63. package/source/typed-array.d.ts +1 -1
  64. package/source/union-to-intersection.d.ts +1 -1
  65. package/source/value-of.d.ts +1 -1
package/index.d.ts CHANGED
@@ -37,6 +37,18 @@ export {SetReturnType} from './source/set-return-type';
37
37
  export {Asyncify} from './source/asyncify';
38
38
  export {Simplify} from './source/simplify';
39
39
  export {Jsonify} from './source/jsonify';
40
+ export {
41
+ PositiveInfinity,
42
+ NegativeInfinity,
43
+ Finite,
44
+ Integer,
45
+ Float,
46
+ NegativeFloat,
47
+ Negative,
48
+ NonNegative,
49
+ NegativeInteger,
50
+ NonNegativeInteger,
51
+ } from './source/numeric';
40
52
 
41
53
  // Template literal types
42
54
  export {CamelCase} from './source/camel-case';
package/license CHANGED
@@ -1,9 +1 @@
1
- MIT License
2
-
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ SPDX-License-Identifier: (MIT OR CC0-1.0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-fest",
3
- "version": "2.5.3",
3
+ "version": "2.8.0",
4
4
  "description": "A collection of essential TypeScript types",
5
5
  "license": "(MIT OR CC0-1.0)",
6
6
  "repository": "sindresorhus/type-fest",
package/readme.md CHANGED
@@ -106,31 +106,57 @@ Click the type names for complete docs.
106
106
  - [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) if you only need one level deep.
107
107
  - [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) if you only need one level deep.
108
108
  - [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).
109
- - [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
110
109
  - [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/).
111
110
  - [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.
112
111
  - [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.
113
112
  - [`ValueOf`](source/value-of.d.ts) - Create a union of the given object's values, and optionally specify which keys to get the values from.
114
- - [`PromiseValue`](source/promise-value.d.ts) - Returns the type that is wrapped inside a `Promise`.
115
- - [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
116
113
  - [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.
117
114
  - [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.
118
115
  - [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.
119
116
  - [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.
120
117
  - [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.
121
- - [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length.
122
- - [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimensions.
123
- - [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimensions.
124
118
  - [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator.
125
119
  - [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection.
126
120
  - [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection.
127
121
  - [`SetReturnType`](source/set-return-type.d.ts) - Create a function type with a return type of your choice and the same parameters as the given function type.
128
- - [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.
129
- - [`Includes`](source/includes.d.ts) - Returns a boolean for whether the given array includes the given item.
130
122
  - [`Simplify`](source/simplify.d.ts) - Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
131
123
  - [`Jsonify`](source/jsonify.d.ts) - Transform a type to one that is assignable to the `JsonValue` type.
124
+ - [`Get`](source/get.d.ts) - Get a deeply-nested property from an object using a key path, like [Lodash's `.get()`](https://lodash.com/docs/latest#get) function.
125
+
126
+ ### Async
127
+
128
+ - [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
129
+ - [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
130
+ - [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.
131
+
132
+ ### String
133
+
134
+ - [`Trim`](source/trim.d.ts) - Remove leading and trailing spaces from a string.
135
+ - [`Split`](source/split.d.ts) - Represents an array of strings split using a given character or character set.
136
+
137
+ ### Array
138
+
139
+ - [`Includes`](source/includes.d.ts) - Returns a boolean for whether the given array includes the given item.
140
+ - [`Join`](source/join.d.ts) - Join an array of strings and/or numbers using the given string as a delimiter.
141
+ - [`LastArrayElement`](source/last-array-element.d.ts) - Extracts the type of the last element of an array.
142
+ - [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length.
143
+ - [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimensions.
144
+ - [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimensions.
145
+
146
+ ### Numeric
132
147
 
133
- ### Template literal types
148
+ - [`PositiveInfinity`](source/numeric.d.ts) - Matches the hidden `Infinity` type.
149
+ - [`NegativeInfinity`](source/numeric.d.ts) - Matches the hidden `-Infinity` type.
150
+ - [`Finite`](source/numeric.d.ts) - A finite `number`.
151
+ - [`Integer`](source/numeric.d.ts) - A `number` that is an integer.
152
+ - [`Float`](source/numeric.d.ts) - A `number` that is not an integer.
153
+ - [`NegativeFloat`](source/numeric.d.ts) - A negative (`-∞ < x < 0`) `number` that is not an integer.
154
+ - [`Negative`](source/numeric.d.ts) - A negative `number`/`bigint` (`-∞ < x < 0`)
155
+ - [`NonNegative`](source/numeric.d.ts) - A non-negative `number`/`bigint` (`0 <= x < ∞`).
156
+ - [`NegativeInteger`](source/numeric.d.ts) - A negative (`-∞ < x < 0`) `number` that is an integer.
157
+ - [`NonNegativeInteger`](source/numeric.d.ts) - A non-negative (`0 <= x < ∞`) `number` that is an integer.
158
+
159
+ ### Change case
134
160
 
135
161
  - [`CamelCase`](source/camel-case.d.ts) – Convert a string literal to camel-case (`fooBar`).
136
162
  - [`CamelCasedProperties`](source/camel-cased-properties.d.ts) – Convert object properties to camel-case (`fooBar`).
@@ -148,11 +174,6 @@ Click the type names for complete docs.
148
174
  - [`DelimiterCase`](source/delimiter-case.d.ts) – Convert a string literal to a custom string delimiter casing.
149
175
  - [`DelimiterCasedProperties`](source/delimiter-cased-properties.d.ts) – Convert object properties to a custom string delimiter casing.
150
176
  - [`DelimiterCasedPropertiesDeep`](source/delimiter-cased-properties-deep.d.ts) – Convert object properties to a custom string delimiter casing recursively.
151
- - [`Join`](source/join.d.ts) - Join an array of strings and/or numbers using the given string as a delimiter.
152
- - [`Split`](source/split.d.ts) - Represents an array of strings split using a given character or character set.
153
- - [`Trim`](source/trim.d.ts) - Remove leading and trailing spaces from a string.
154
- - [`Get`](source/get.d.ts) - Get a deeply-nested property from an object using a key path, like [Lodash's `.get()`](https://lodash.com/docs/latest#get) function.
155
- - [`LastArrayElement`](source/last-array-element.d.ts) - Extracts the type of the last element of an array.
156
177
 
157
178
  ### Miscellaneous
158
179
 
@@ -167,6 +188,7 @@ Click the type names for complete docs.
167
188
  - [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary<number>` vs `Record<string, number>`) from [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.
168
189
  - [`ExtractProperties` and `ExtractMethods`](https://github.com/sindresorhus/type-fest/pull/4) - The types violate the single responsibility principle. Instead, refine your types into more granular type hierarchies.
169
190
  - [`Url2Json`](https://github.com/sindresorhus/type-fest/pull/262) - Inferring search parameters from a URL string is a cute idea, but not very useful in practice, since search parameters are usually dynamic and defined separately.
191
+ - [`Nullish`](https://github.com/sindresorhus/type-fest/pull/318) - The type only saves a couple of characters, not everyone knows what “nullish” means, and I'm also trying to [get away from `null`](https://github.com/sindresorhus/meta/discussions/7).
170
192
 
171
193
  ## Alternative type names
172
194
 
@@ -793,7 +815,7 @@ You can find some examples in the [TypeScript docs](https://www.typescriptlang.o
793
815
 
794
816
  ## License
795
817
 
796
- (MIT OR CC0-1.0)
818
+ SPDX-License-Identifier: (MIT OR CC0-1.0)
797
819
 
798
820
  ---
799
821
 
@@ -20,6 +20,6 @@ async function doSomething(value: Value) {}
20
20
  asyncFunction().then(value => doSomething(value));
21
21
  ```
22
22
 
23
- @category Utilities
23
+ @category Async
24
24
  */
25
25
  export type AsyncReturnType<Target extends AsyncFunction> = PromiseValue<ReturnType<Target>>;
@@ -28,6 +28,6 @@ const getFooAsync: AsyncifiedFooGetter = (someArg) => {
28
28
  }
29
29
  ```
30
30
 
31
- @category Utilities
31
+ @category Async
32
32
  */
33
33
  export type Asyncify<Fn extends (...args: any[]) => any> = SetReturnType<Fn, Promise<PromiseValue<ReturnType<Fn>>>>;
package/source/basic.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
3
3
 
4
- @category Basic
4
+ @category Class
5
5
  */
6
6
  export type Class<T, Arguments extends unknown[] = any[]> = Constructor<T, Arguments> & {prototype: T};
7
7
 
8
8
  /**
9
9
  Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
10
10
 
11
- @category Basic
11
+ @category Class
12
12
  */
13
13
  export type Constructor<T, Arguments extends unknown[] = any[]> = new(...arguments_: Arguments) => T;
14
14
 
@@ -17,21 +17,21 @@ Matches a JSON object.
17
17
 
18
18
  This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
19
19
 
20
- @category Basic
20
+ @category JSON
21
21
  */
22
22
  export type JsonObject = {[Key in string]?: JsonValue};
23
23
 
24
24
  /**
25
25
  Matches a JSON array.
26
26
 
27
- @category Basic
27
+ @category JSON
28
28
  */
29
29
  export type JsonArray = JsonValue[];
30
30
 
31
31
  /**
32
32
  Matches any valid JSON primitive value.
33
33
 
34
- @category Basic
34
+ @category JSON
35
35
  */
36
36
  export type JsonPrimitive = string | number | boolean | null;
37
37
 
@@ -40,6 +40,6 @@ Matches any valid JSON value.
40
40
 
41
41
  @see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.
42
42
 
43
- @category Basic
43
+ @category JSON
44
44
  */
45
45
  export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
@@ -67,6 +67,7 @@ const dbResult: CamelCasedProperties<RawOptions> = {
67
67
  };
68
68
  ```
69
69
 
70
- @category Template Literals
70
+ @category Change case
71
+ @category Template literal
71
72
  */
72
73
  export type CamelCase<K> = K extends string ? CamelCaseStringArray<Split<K extends Uppercase<K> ? Lowercase<K> : K, WordSeparators>> : K;
@@ -38,7 +38,9 @@ const result: CamelCasedPropertiesDeep<UserWithFriends> = {
38
38
  };
39
39
  ```
40
40
 
41
- @category Template Literals
41
+ @category Change case
42
+ @category Template literal
43
+ @category Object
42
44
  */
43
45
  export type CamelCasedPropertiesDeep<Value> = Value extends Function
44
46
  ? Value
@@ -21,7 +21,9 @@ const result: CamelCasedProperties<User> = {
21
21
  };
22
22
  ```
23
23
 
24
- @category Template Literals
24
+ @category Change case
25
+ @category Template literal
26
+ @category Object
25
27
  */
26
28
  export type CamelCasedProperties<Value> = Value extends Function
27
29
  ? Value
@@ -37,7 +37,7 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
37
37
  //=> {b: string | number; c: () => void; d: {}}
38
38
  ```
39
39
 
40
- @category Utilities
40
+ @category Object
41
41
  */
42
42
  export type ConditionalExcept<Base, Condition> = Except<
43
43
  Base,
@@ -26,7 +26,7 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
26
26
  //=> 'a' | 'c'
27
27
  ```
28
28
 
29
- @category Utilities
29
+ @category Object
30
30
  */
31
31
  export type ConditionalKeys<Base, Condition> = NonNullable<
32
32
  // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
@@ -36,7 +36,7 @@ type StringKeysOnly = ConditionalPick<Example, string>;
36
36
  //=> {a: string}
37
37
  ```
38
38
 
39
- @category Utilities
39
+ @category Object
40
40
  */
41
41
  export type ConditionalPick<Base, Condition> = Pick<
42
42
  Base,
@@ -3,7 +3,7 @@ import {UpperCaseCharacters, WordSeparators} from '../source/utilities';
3
3
  /**
4
4
  Unlike a simpler split, this one includes the delimiter splitted on in the resulting array literal. This is to enable splitting on, for example, upper-case characters.
5
5
 
6
- @category Template Literals
6
+ @category Template literal
7
7
  */
8
8
  export type SplitIncludingDelimiters<Source extends string, Delimiter extends string> =
9
9
  Source extends '' ? [] :
@@ -40,6 +40,8 @@ It receives `UsedWordSeparators` and `UsedUpperCaseCharacters` as input to ensur
40
40
  type StringArrayToDelimiterCase<Parts extends readonly any[], Start extends boolean, UsedWordSeparators extends string, UsedUpperCaseCharacters extends string, Delimiter extends string> =
41
41
  Parts extends [`${infer FirstPart}`, ...infer RemainingParts]
42
42
  ? `${StringPartToDelimiterCase<FirstPart, Start, UsedWordSeparators, UsedUpperCaseCharacters, Delimiter>}${StringArrayToDelimiterCase<RemainingParts, false, UsedWordSeparators, UsedUpperCaseCharacters, Delimiter>}`
43
+ : Parts extends [string]
44
+ ? string
43
45
  : '';
44
46
 
45
47
  /**
@@ -77,7 +79,8 @@ const rawCliOptions: OddlyCasedProperties<SomeOptions> = {
77
79
  };
78
80
  ```
79
81
 
80
- @category Template Literals
82
+ @category Change case
83
+ @category Template literal
81
84
  */
82
85
  export type DelimiterCase<Value, Delimiter extends string> = Value extends string
83
86
  ? StringArrayToDelimiterCase<
@@ -38,7 +38,9 @@ const result: DelimiterCasedPropertiesDeep<UserWithFriends, '-'> = {
38
38
  };
39
39
  ```
40
40
 
41
- @category Template Literals
41
+ @category Change case
42
+ @category Template literal
43
+ @category Object
42
44
  */
43
45
  export type DelimiterCasedPropertiesDeep<
44
46
  Value,
@@ -21,7 +21,9 @@ const result: DelimiterCasedProperties<User, '-'> = {
21
21
  };
22
22
  ```
23
23
 
24
- @category Template Literals
24
+ @category Change case
25
+ @category Template literal
26
+ @category Object
25
27
  */
26
28
  export type DelimiterCasedProperties<
27
29
  Value,
@@ -49,7 +49,10 @@ const setExample = new Set(['a', 1]);
49
49
  const setEntries: Entries<typeof setExample> = [['a', 'a'], [1, 1]];
50
50
  ```
51
51
 
52
- @category Utilities
52
+ @category Object
53
+ @category Map
54
+ @category Set
55
+ @category Array
53
56
  */
54
57
  export type Entries<BaseType> =
55
58
  BaseType extends Map<unknown, unknown> ? MapEntries<BaseType>
package/source/entry.d.ts CHANGED
@@ -52,7 +52,10 @@ const setEntryString: Entry<typeof setExample> = ['a', 'a'];
52
52
  const setEntryNumber: Entry<typeof setExample> = [1, 1];
53
53
  ```
54
54
 
55
- @category Utilities
55
+ @category Object
56
+ @category Map
57
+ @category Array
58
+ @category Set
56
59
  */
57
60
  export type Entry<BaseType> =
58
61
  BaseType extends Map<unknown, unknown> ? MapEntry<BaseType>
@@ -50,7 +50,7 @@ type FooWithoutA = Except<Foo, 'a' | 'c'>;
50
50
  //=> {b: string};
51
51
  ```
52
52
 
53
- @category Utilities
53
+ @category Object
54
54
  */
55
55
  export type Except<ObjectType, KeysType extends keyof ObjectType> = {
56
56
  [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
@@ -28,7 +28,7 @@ guestFencingTeam.push('Sam');
28
28
  //=> error TS2339: Property 'push' does not exist on type 'FencingTeam'
29
29
  ```
30
30
 
31
- @category Utilities
31
+ @category Array
32
32
  */
33
33
  export type FixedLengthArray<Element, Length extends number, ArrayPrototype = [Element, ...Element[]]> = Pick<
34
34
  ArrayPrototype,
package/source/get.d.ts CHANGED
@@ -130,6 +130,8 @@ const getName = (apiResponse: ApiResponse) =>
130
130
  //=> Array<{given: string[]; family: string}>
131
131
  ```
132
132
 
133
- @category Template Literals
133
+ @category Template literal
134
+ @category Object
135
+ @category Array
134
136
  */
135
137
  export type Get<BaseType, Path extends string> = GetWithPath<BaseType, ToPath<Path>>;
@@ -12,7 +12,7 @@ import {Includes} from 'type-fest';
12
12
  type hasRed<array extends any[]> = Includes<array, 'red'>;
13
13
  ```
14
14
 
15
- @category Utilities
15
+ @category Array
16
16
  */
17
17
  export type Includes<Value extends readonly any[], Item> =
18
18
  IsEqual<Value[0], Item> extends true
@@ -38,7 +38,7 @@ An example with an array of strings:
38
38
  type MeString = IterableElement<string[]>
39
39
  ```
40
40
 
41
- @category Utilities
41
+ @category Iterable
42
42
  */
43
43
  export type IterableElement<TargetIterable> =
44
44
  TargetIterable extends Iterable<infer ElementType> ?
package/source/join.d.ts CHANGED
@@ -17,7 +17,8 @@ const path: Join<['foo', 'bar', 'baz'], '.'> = ['foo', 'bar', 'baz'].join('.');
17
17
  const path: Join<[1, 2, 3], '.'> = [1, 2, 3].join('.');
18
18
  ```
19
19
 
20
- @category Template Literals
20
+ @category Array
21
+ @category Template literal
21
22
  */
22
23
  export type Join<
23
24
  Strings extends Array<string | number>,
@@ -54,7 +54,7 @@ const timeJson = JSON.parse(JSON.stringify(time)) as Jsonify<typeof time>;
54
54
 
55
55
  @link https://github.com/Microsoft/TypeScript/issues/1897#issuecomment-710744173
56
56
 
57
- @category Utilities
57
+ @category JSON
58
58
  */
59
59
  type Jsonify<T> =
60
60
  // Check if there are any non-JSONable types represented in the union.
@@ -32,6 +32,7 @@ const rawCliOptions: KebabCasedProperties<CliOptions> = {
32
32
  };
33
33
  ```
34
34
 
35
- @category Template Literals
35
+ @category Change case
36
+ @category Template literal
36
37
  */
37
38
  export type KebabCase<Value> = DelimiterCase<Value, '-'>;
@@ -38,6 +38,8 @@ const result: KebabCasedPropertiesDeep<UserWithFriends> = {
38
38
  };
39
39
  ```
40
40
 
41
- @category Template Literals
41
+ @category Change case
42
+ @category Template literal
43
+ @category Object
42
44
  */
43
45
  export type KebabCasedPropertiesDeep<Value> = DelimiterCasedPropertiesDeep<Value, '-'>;
@@ -21,6 +21,8 @@ const result: KebabCasedProperties<User> = {
21
21
  };
22
22
  ```
23
23
 
24
- @category Template Literals
24
+ @category Change case
25
+ @category Template literal
26
+ @category Object
25
27
  */
26
28
  export type KebabCasedProperties<Value> = DelimiterCasedProperties<Value, '-'>;
@@ -15,7 +15,8 @@ typeof lastOf(array);
15
15
  //=> number
16
16
  ```
17
17
 
18
- @category Template Literals
18
+ @category Array
19
+ @category Template literal
19
20
  */
20
21
  export type LastArrayElement<ValueType extends readonly unknown[]> =
21
22
  ValueType extends readonly [infer ElementType]
@@ -27,7 +27,7 @@ const pet: Pet2 = '';
27
27
  // You **will** get auto-completion for `dog` and `cat` literals.
28
28
  ```
29
29
 
30
- @category Utilities
30
+ @category Type
31
31
  */
32
32
  export type LiteralUnion<
33
33
  LiteralType,
@@ -32,7 +32,7 @@ exclusiveOptions = {exclusive1: true, exclusive2: 'hi'};
32
32
  //=> Error
33
33
  ```
34
34
 
35
- @category Utilities
35
+ @category Object
36
36
  */
37
37
  export type MergeExclusive<FirstType, SecondType> =
38
38
  (FirstType | SecondType) extends object ?
package/source/merge.d.ts CHANGED
@@ -22,6 +22,6 @@ type Bar = {
22
22
  const ab: Merge<Foo, Bar> = {a: 1, b: 2};
23
23
  ```
24
24
 
25
- @category Utilities
25
+ @category Object
26
26
  */
27
27
  export type Merge<FirstType, SecondType> = Simplify<Merge_<FirstType, SecondType>>;
@@ -34,7 +34,7 @@ const matrix = emptyMatrix(3);
34
34
  matrix[0][0][0] = 42;
35
35
  ```
36
36
 
37
- @category Utilities
37
+ @category Array
38
38
  */
39
39
  export type MultidimensionalArray<Element, Dimensions extends number> = number extends Dimensions
40
40
  ? Recursive<Element>
@@ -38,7 +38,7 @@ const matrix = emptyMatrix(3);
38
38
  const answer = matrix[0][0][0]; // 42
39
39
  ```
40
40
 
41
- @category Utilities
41
+ @category Array
42
42
  */
43
43
  export type MultidimensionalReadonlyArray<Element, Dimensions extends number> = number extends Dimensions
44
44
  ? Recursive<Element>
@@ -29,7 +29,7 @@ type SomeMutable = Mutable<Foo, 'b' | 'c'>;
29
29
  // }
30
30
  ```
31
31
 
32
- @category Utilities
32
+ @category Object
33
33
  */
34
34
  export type Mutable<BaseType, Keys extends keyof BaseType = keyof BaseType> =
35
35
  Simplify<
@@ -0,0 +1,168 @@
1
+ type Numeric = number | bigint;
2
+
3
+ type Zero = 0 | 0n;
4
+
5
+ /**
6
+ Matches the hidden `Infinity` type.
7
+
8
+ Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.
9
+
10
+ @see NegativeInfinity
11
+
12
+ @category Numeric
13
+ */
14
+ // See https://github.com/microsoft/TypeScript/issues/31752
15
+ // eslint-disable-next-line @typescript-eslint/no-loss-of-precision
16
+ export type PositiveInfinity = 1e999;
17
+
18
+ /**
19
+ Matches the hidden `-Infinity` type.
20
+
21
+ Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.
22
+
23
+ @see PositiveInfinity
24
+
25
+ @category Numeric
26
+ */
27
+ // See https://github.com/microsoft/TypeScript/issues/31752
28
+ // eslint-disable-next-line @typescript-eslint/no-loss-of-precision
29
+ export type NegativeInfinity = -1e999;
30
+
31
+ /**
32
+ A finite `number`.
33
+ You can't pass a `bigint` as they are already guaranteed to be finite.
34
+
35
+ Use-case: Validating and documenting parameters.
36
+
37
+ @example
38
+ ```
39
+ import {Finite} from 'type-fest';
40
+
41
+ declare function setScore<T extends number>(length: Finite<T>): void;
42
+ ```
43
+
44
+ @category Numeric
45
+ */
46
+ export type Finite<T extends number> = T extends PositiveInfinity | NegativeInfinity ? never : T;
47
+
48
+ /**
49
+ A `number` that is an integer.
50
+ You can't pass a `bigint` as they are already guaranteed to be integers.
51
+
52
+ Use-case: Validating and documenting parameters.
53
+
54
+ @example
55
+ ```
56
+ import {Integer} from 'type-fest';
57
+
58
+ declare function setYear<T extends number>(length: Integer<T>): void;
59
+ ```
60
+
61
+ @see NegativeInteger
62
+ @see NonNegativeInteger
63
+
64
+ @category Numeric
65
+ */
66
+ // `${bigint}` is a type that matches a valid bigint literal without the `n` (ex. 1, 0b1, 0o1, 0x1)
67
+ // Because T is a number and not a string we can effectively use this to filter out any numbers containing decimal points
68
+ export type Integer<T extends number> = `${T}` extends `${bigint}` ? T : never;
69
+
70
+ /**
71
+ A `number` that is not an integer.
72
+ You can't pass a `bigint` as they are already guaranteed to be integers.
73
+
74
+ Use-case: Validating and documenting parameters.
75
+
76
+ @example
77
+ ```
78
+ import {Float} from 'type-fest';
79
+
80
+ declare function setPercentage<T extends number>(length: Float<T>): void;
81
+ ```
82
+
83
+ @see Integer
84
+
85
+ @category Numeric
86
+ */
87
+ export type Float<T extends number> = T extends Integer<T> ? never : T;
88
+
89
+ /**
90
+ A negative (`-∞ < x < 0`) `number` that is not an integer.
91
+ Equivalent to `Negative<Float<T>>`.
92
+
93
+ Use-case: Validating and documenting parameters.
94
+
95
+ @see Negative
96
+ @see Float
97
+
98
+ @category Numeric
99
+ */
100
+ export type NegativeFloat<T extends number> = Negative<Float<T>>;
101
+
102
+ /**
103
+ A negative `number`/`bigint` (`-∞ < x < 0`)
104
+
105
+ Use-case: Validating and documenting parameters.
106
+
107
+ @see NegativeInteger
108
+ @see NonNegative
109
+
110
+ @category Numeric
111
+ */
112
+ export type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never;
113
+
114
+ /**
115
+ A negative (`-∞ < x < 0`) `number` that is an integer.
116
+ Equivalent to `Negative<Integer<T>>`.
117
+
118
+ You can't pass a `bigint` as they are already guaranteed to be integers, instead use `Negative<T>`.
119
+
120
+ Use-case: Validating and documenting parameters.
121
+
122
+ @see Negative
123
+ @see Integer
124
+
125
+ @category Numeric
126
+ */
127
+ export type NegativeInteger<T extends number> = Negative<Integer<T>>;
128
+
129
+ /**
130
+ A non-negative `number`/`bigint` (`0 <= x < ∞`).
131
+
132
+ Use-case: Validating and documenting parameters.
133
+
134
+ @see NonNegativeInteger
135
+ @see Negative
136
+
137
+ @example
138
+ ```
139
+ import {NonNegative} from 'type-fest';
140
+
141
+ declare function setLength<T extends number>(length: NonNegative<T>): void;
142
+ ```
143
+
144
+ @category Numeric
145
+ */
146
+ export type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : never;
147
+
148
+ /**
149
+ A non-negative (`0 <= x < ∞`) `number` that is an integer.
150
+ Equivalent to `NonNegative<Integer<T>>`.
151
+
152
+ You can't pass a `bigint` as they are already guaranteed to be integers, instead use `NonNegative<T>`.
153
+
154
+ Use-case: Validating and documenting parameters.
155
+
156
+ @see NonNegative
157
+ @see Integer
158
+
159
+ @example
160
+ ```
161
+ import {NonNegativeInteger} from 'type-fest';
162
+
163
+ declare function setLength<T extends number>(length: NonNegativeInteger<T>): void;
164
+ ```
165
+
166
+ @category Numeric
167
+ */
168
+ export type NonNegativeInteger<T extends number> = NonNegative<Integer<T>>;
@@ -11,15 +11,29 @@ As well, some guideance on making an `Observable` do not include `closed` proper
11
11
  @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
12
12
  @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
13
13
  @see https://github.com/benlesh/symbol-observable#making-an-object-observable
14
+
15
+ @category Observable
14
16
  */
15
17
  export type Unsubscribable = {
16
18
  unsubscribe(): void;
17
19
  };
18
20
 
21
+ /**
22
+ @category Observable
23
+ */
19
24
  type OnNext<ValueType> = (value: ValueType) => void;
25
+ /**
26
+ @category Observable
27
+ */
20
28
  type OnError = (error: unknown) => void;
29
+ /**
30
+ @category Observable
31
+ */
21
32
  type OnComplete = () => void;
22
33
 
34
+ /**
35
+ @category Observable
36
+ */
23
37
  export type Observer<ValueType> = {
24
38
  next: OnNext<ValueType>;
25
39
  error: OnError;
@@ -40,7 +54,7 @@ But `Observable` implementations have evolved to preferring case 2 and some impl
40
54
  @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L246-L259
41
55
  @see https://benlesh.com/posts/learning-observable-by-building-observable/
42
56
 
43
- @category Basic
57
+ @category Observable
44
58
  */
45
59
  export interface ObservableLike<ValueType = unknown> {
46
60
  subscribe(observer?: Partial<Observer<ValueType>>): Unsubscribable;
@@ -69,6 +69,6 @@ type Person = {
69
69
  };
70
70
  ```
71
71
 
72
- @category Utilities
72
+ @category Type
73
73
  */
74
74
  export type Opaque<Type, Token = unknown> = Type & Tagged<Token>;
@@ -635,7 +635,7 @@ declare namespace PackageJson {
635
635
  /**
636
636
  Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
637
637
 
638
- @category Miscellaneous
638
+ @category File
639
639
  */
640
640
  export type PackageJson =
641
641
  PackageJson.PackageJsonStandard &
@@ -28,7 +28,10 @@ const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
28
28
  settings = applySavedSettings({textEditor: {fontWeight: 500}});
29
29
  ```
30
30
 
31
- @category Utilities
31
+ @category Object
32
+ @category Array
33
+ @category Set
34
+ @category Map
32
35
  */
33
36
  export type PartialDeep<T> = T extends Primitive
34
37
  ? Partial<T>
@@ -30,7 +30,8 @@ const dbResult: CamelCasedProperties<ModelProps> = {
30
30
  };
31
31
  ```
32
32
 
33
- @category Template Literals
33
+ @category Change case
34
+ @category Template literal
34
35
  */
35
36
  export type PascalCase<Value> = CamelCase<Value> extends string
36
37
  ? Capitalize<CamelCase<Value>>
@@ -38,7 +38,9 @@ const result: PascalCasedPropertiesDeep<UserWithFriends> = {
38
38
  };
39
39
  ```
40
40
 
41
- @category Template Literals
41
+ @category Change case
42
+ @category Template literal
43
+ @category Object
42
44
  */
43
45
  export type PascalCasedPropertiesDeep<Value> = Value extends Function
44
46
  ? Value
@@ -21,7 +21,9 @@ const result: PascalCasedProperties<User> = {
21
21
  };
22
22
  ```
23
23
 
24
- @category Template Literals
24
+ @category Change case
25
+ @category Template literal
26
+ @category Object
25
27
  */
26
28
  export type PascalCasedProperties<Value> = Value extends Function
27
29
  ? Value
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
3
3
 
4
- @category Basic
4
+ @category Type
5
5
  */
6
6
  export type Primitive =
7
7
  | null
@@ -18,8 +18,8 @@ async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
18
18
 
19
19
  logger(() => 'foo');
20
20
  logger(() => Promise.resolve('bar'));
21
-
22
- @category Utilities
23
21
  ```
22
+
23
+ @category Async
24
24
  */
25
25
  export type Promisable<T> = T | PromiseLike<T>;
@@ -1,4 +1,6 @@
1
1
  /**
2
+ @deprecated Use the built-in [`Awaited` type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#the-awaited-type-and-promise-improvements) instead.
3
+
2
4
  Returns the type that is wrapped inside a `Promise` type.
3
5
  If the type is a nested Promise, it is unwrapped recursively until a non-Promise type is obtained.
4
6
  If the type is not a `Promise`, the type itself is returned.
@@ -22,6 +24,6 @@ type RecursiveAsyncData = Promise<Promise<string> >;
22
24
  let recursiveAsyncData: PromiseValue<RecursiveAsyncData> = Promise.resolve(Promise.resolve('ABC'));
23
25
  ```
24
26
 
25
- @category Utilities
27
+ @category Async
26
28
  */
27
29
  export type PromiseValue<PromiseType> = PromiseType extends PromiseLike<infer Value> ? PromiseValue<Value> : PromiseType;
@@ -29,7 +29,10 @@ data.foo.push('bar');
29
29
  //=> error TS2339: Property 'push' does not exist on type 'readonly string[]'
30
30
  ```
31
31
 
32
- @category Utilities
32
+ @category Object
33
+ @category Array
34
+ @category Set
35
+ @category Map
33
36
  */
34
37
  export type ReadonlyDeep<T> = T extends Primitive | ((...arguments: any[]) => unknown)
35
38
  ? T
@@ -27,7 +27,7 @@ const responder2: RequireAllOrNone<Responder, 'text' | 'json'> = {
27
27
  };
28
28
  ```
29
29
 
30
- @category Utilities
30
+ @category Object
31
31
  */
32
32
  export type RequireAllOrNone<ObjectType, KeysType extends keyof ObjectType = never> = (
33
33
  | Required<Pick<ObjectType, KeysType>> // Require all of the given keys.
@@ -20,7 +20,7 @@ const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
20
20
  };
21
21
  ```
22
22
 
23
- @category Utilities
23
+ @category Object
24
24
  */
25
25
  export type RequireAtLeastOne<
26
26
  ObjectType,
@@ -25,7 +25,7 @@ const responder: RequireExactlyOne<Responder, 'text' | 'json'> = {
25
25
  };
26
26
  ```
27
27
 
28
- @category Utilities
28
+ @category Object
29
29
  */
30
30
  export type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
31
31
  {[Key in KeysType]: (
@@ -23,7 +23,8 @@ import {ScreamingSnakeCase} from 'type-fest';
23
23
  const someVariable: ScreamingSnakeCase<'fooBar'> = 'FOO_BAR';
24
24
  ```
25
25
 
26
- @category Template Literals
26
+ @category Change case
27
+ @category Template literal
27
28
  */
28
29
  export type ScreamingSnakeCase<Value> = Value extends string
29
30
  ? IsScreamingSnakeCase<Value> extends true
@@ -24,7 +24,7 @@ type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
24
24
  // }
25
25
  ```
26
26
 
27
- @category Utilities
27
+ @category Object
28
28
  */
29
29
  export type SetOptional<BaseType, Keys extends keyof BaseType> =
30
30
  Simplify<
@@ -24,7 +24,7 @@ type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
24
24
  // }
25
25
  ```
26
26
 
27
- @category Utilities
27
+ @category Object
28
28
  */
29
29
  export type SetRequired<BaseType, Keys extends keyof BaseType> =
30
30
  Simplify<
@@ -17,7 +17,7 @@ type MyWrappedFunction = SetReturnType<MyFunctionThatCanThrow, SomeOtherType | u
17
17
  //=> type MyWrappedFunction = (foo: SomeType, bar: unknown) => SomeOtherType | undefined;
18
18
  ```
19
19
 
20
- @category Utilities
20
+ @category Function
21
21
  */
22
22
  export type SetReturnType<Fn extends (...args: any[]) => any, TypeToReturn> =
23
23
  // Just using `Parameters<Fn>` isn't ideal because it doesn't handle the `this` fake parameter.
@@ -53,6 +53,6 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
53
53
 
54
54
  @link https://github.com/microsoft/TypeScript/issues/15300
55
55
 
56
- @category Utilities
56
+ @category Object
57
57
  */
58
58
  export type Simplify<T> = {[KeyType in keyof T]: T[KeyType]};
@@ -32,6 +32,7 @@ const dbResult: SnakeCasedProperties<ModelProps> = {
32
32
  };
33
33
  ```
34
34
 
35
- @category Template Literals
35
+ @category Change case
36
+ @category Template literal
36
37
  */
37
38
  export type SnakeCase<Value> = DelimiterCase<Value, '_'>;
@@ -38,6 +38,8 @@ const result: SnakeCasedPropertiesDeep<UserWithFriends> = {
38
38
  };
39
39
  ```
40
40
 
41
- @category Template Literals
41
+ @category Change case
42
+ @category Template literal
43
+ @category Object
42
44
  */
43
45
  export type SnakeCasedPropertiesDeep<Value> = DelimiterCasedPropertiesDeep<Value, '_'>;
@@ -21,6 +21,8 @@ const result: SnakeCasedProperties<User> = {
21
21
  };
22
22
  ```
23
23
 
24
- @category Template Literals
24
+ @category Change case
25
+ @category Template literal
26
+ @category Object
25
27
  */
26
28
  export type SnakeCasedProperties<Value> = DelimiterCasedProperties<Value, '_'>;
package/source/split.d.ts CHANGED
@@ -16,7 +16,8 @@ let array: Item[];
16
16
  array = split(items, ',');
17
17
  ```
18
18
 
19
- @category Template Literals
19
+ @category String
20
+ @category Template literal
20
21
  */
21
22
  export type Split<
22
23
  S extends string,
@@ -18,6 +18,6 @@ const carForm: Stringified<Car> = {
18
18
  };
19
19
  ```
20
20
 
21
- @category Utilities
21
+ @category Object
22
22
  */
23
23
  export type Stringified<ObjectType> = {[KeyType in keyof ObjectType]: string};
package/source/trim.d.ts CHANGED
@@ -19,6 +19,7 @@ Trim<' foo '>
19
19
  //=> 'foo'
20
20
  ```
21
21
 
22
- @category Template Literals
22
+ @category String
23
+ @category Template literal
23
24
  */
24
25
  export type Trim<V extends string> = TrimLeft<TrimRight<V>>;
@@ -15,6 +15,7 @@ declare namespace TsConfigJson {
15
15
  | 'ES6'
16
16
  | 'ES2015'
17
17
  | 'ES2020'
18
+ | 'ES2022'
18
19
  | 'ESNext'
19
20
  | 'None'
20
21
  // Lowercase alternatives
@@ -25,6 +26,7 @@ declare namespace TsConfigJson {
25
26
  | 'es6'
26
27
  | 'es2015'
27
28
  | 'es2020'
29
+ | 'es2022'
28
30
  | 'esnext'
29
31
  | 'none';
30
32
 
@@ -1038,7 +1040,7 @@ declare namespace TsConfigJson {
1038
1040
  /**
1039
1041
  Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).
1040
1042
 
1041
- @category Miscellaneous
1043
+ @category File
1042
1044
  */
1043
1045
  export interface TsConfigJson {
1044
1046
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
3
3
 
4
- @category Basic
4
+ @category Array
5
5
  */
6
6
  export type TypedArray =
7
7
  | Int8Array
@@ -41,7 +41,7 @@ type Intersection = UnionToIntersection<Union>;
41
41
  //=> {a1(): void; b1(): void; a2(argA: string): void; b2(argB: string): void}
42
42
  ```
43
43
 
44
- @category Utilities
44
+ @category Type
45
45
  */
46
46
  export type UnionToIntersection<Union> = (
47
47
  // `extends unknown` is always going to be the case and is used to convert the
@@ -37,6 +37,6 @@ onlyBar('bar');
37
37
  //=> 2
38
38
  ```
39
39
 
40
- @category Utilities
40
+ @category Object
41
41
  */
42
42
  export type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];