@depup/type-fest 5.5.0-depup.0 → 5.10.0-depup.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 (120) hide show
  1. package/README.md +2 -2
  2. package/changes.json +1 -1
  3. package/index.d.ts +17 -8
  4. package/package.json +9 -6
  5. package/readme.md +75 -61
  6. package/source/absolute.d.ts +52 -0
  7. package/source/all-extend.d.ts +9 -5
  8. package/source/all-union-fields.d.ts +18 -18
  9. package/source/and.d.ts +1 -1
  10. package/source/array-reverse.d.ts +17 -15
  11. package/source/array-splice.d.ts +24 -24
  12. package/source/array-tail.d.ts +7 -7
  13. package/source/camel-case.d.ts +38 -5
  14. package/source/camel-cased-properties-deep.d.ts +11 -4
  15. package/source/camel-cased-properties.d.ts +5 -1
  16. package/source/conditional-keys.d.ts +1 -1
  17. package/source/delimiter-case.d.ts +11 -9
  18. package/source/delimiter-cased-properties-deep.d.ts +8 -1
  19. package/source/delimiter-cased-properties.d.ts +5 -1
  20. package/source/empty-object.d.ts +1 -1
  21. package/source/entries.d.ts +1 -1
  22. package/source/entry.d.ts +1 -1
  23. package/source/exclude-exactly.d.ts +11 -11
  24. package/source/exclude-rest-element.d.ts +4 -4
  25. package/source/exclusify-union.d.ts +4 -4
  26. package/source/extends-strict.d.ts +129 -22
  27. package/source/extract-exactly.d.ts +56 -0
  28. package/source/get.d.ts +1 -1
  29. package/source/greater-than.d.ts +3 -2
  30. package/source/has-optional-keys.d.ts +1 -1
  31. package/source/has-readonly-keys.d.ts +1 -1
  32. package/source/has-required-keys.d.ts +1 -1
  33. package/source/has-writable-keys.d.ts +1 -1
  34. package/source/int-closed-range.d.ts +5 -4
  35. package/source/int-range.d.ts +57 -12
  36. package/source/internal/array.d.ts +22 -21
  37. package/source/internal/keys.d.ts +9 -9
  38. package/source/internal/numeric.d.ts +19 -65
  39. package/source/internal/object.d.ts +44 -6
  40. package/source/internal/string.d.ts +1 -76
  41. package/source/internal/tuple.d.ts +2 -2
  42. package/source/internal/type.d.ts +16 -10
  43. package/source/is-boolean-literal.d.ts +39 -0
  44. package/source/is-integer.d.ts +8 -8
  45. package/source/is-literal.d.ts +43 -267
  46. package/source/is-numeric-literal.d.ts +50 -0
  47. package/source/is-string-literal.d.ts +72 -0
  48. package/source/is-symbol-literal.d.ts +39 -0
  49. package/source/is-tuple.d.ts +3 -3
  50. package/source/is-union.d.ts +12 -12
  51. package/source/iterable-element.d.ts +5 -5
  52. package/source/jsonify.d.ts +5 -9
  53. package/source/kebab-case.d.ts +1 -0
  54. package/source/kebab-cased-properties-deep.d.ts +7 -0
  55. package/source/kebab-cased-properties.d.ts +5 -1
  56. package/source/keys-of-union.d.ts +2 -2
  57. package/source/last-array-element.d.ts +66 -13
  58. package/source/less-than-or-equal.d.ts +1 -1
  59. package/source/literal-to-primitive.d.ts +1 -1
  60. package/source/literal-union.d.ts +1 -1
  61. package/source/merge-deep.d.ts +3 -3
  62. package/source/merge-exclusive.d.ts +3 -3
  63. package/source/multidimensional-array.d.ts +1 -1
  64. package/source/multidimensional-readonly-array.d.ts +1 -1
  65. package/source/non-nullable-deep.d.ts +102 -0
  66. package/source/numeric.d.ts +3 -3
  67. package/source/object-merge.d.ts +21 -16
  68. package/source/omit-deep.d.ts +22 -22
  69. package/source/or.d.ts +1 -1
  70. package/source/package-json.d.ts +7 -7
  71. package/source/partial-deep.d.ts +3 -1
  72. package/source/pascal-case.d.ts +1 -0
  73. package/source/pascal-cased-properties-deep.d.ts +7 -0
  74. package/source/pascal-cased-properties.d.ts +5 -1
  75. package/source/pick-deep.d.ts +2 -0
  76. package/source/readonly-deep.d.ts +5 -3
  77. package/source/remove-prefix.d.ts +16 -34
  78. package/source/remove-suffix.d.ts +114 -0
  79. package/source/rename-keys.d.ts +163 -0
  80. package/source/replace.d.ts +2 -2
  81. package/source/require-all-or-none.d.ts +5 -5
  82. package/source/require-at-least-one.d.ts +9 -11
  83. package/source/require-exactly-one.d.ts +7 -7
  84. package/source/require-one-or-none.d.ts +5 -5
  85. package/source/required-deep.d.ts +3 -1
  86. package/source/schema.d.ts +16 -8
  87. package/source/screaming-snake-case.d.ts +1 -0
  88. package/source/set-non-nullable-deep.d.ts +8 -4
  89. package/source/set-non-nullable.d.ts +1 -1
  90. package/source/set-optional.d.ts +5 -5
  91. package/source/set-readonly.d.ts +3 -3
  92. package/source/set-required-deep.d.ts +3 -2
  93. package/source/set-required.d.ts +13 -12
  94. package/source/shared-union-fields-deep.d.ts +6 -4
  95. package/source/shared-union-fields.d.ts +9 -9
  96. package/source/snake-case.d.ts +1 -0
  97. package/source/snake-cased-properties-deep.d.ts +7 -0
  98. package/source/snake-cased-properties.d.ts +5 -1
  99. package/source/some-extend.d.ts +9 -5
  100. package/source/split-on-rest-element.d.ts +20 -17
  101. package/source/split.d.ts +22 -11
  102. package/source/string-length.d.ts +38 -0
  103. package/source/string-repeat.d.ts +48 -21
  104. package/source/string-slice.d.ts +1 -1
  105. package/source/string-to-array.d.ts +97 -0
  106. package/source/string-to-number.d.ts +67 -0
  107. package/source/subtract.d.ts +4 -3
  108. package/source/sum.d.ts +5 -4
  109. package/source/tagged.d.ts +3 -5
  110. package/source/tsconfig-json.d.ts +40 -8
  111. package/source/tuple-of.d.ts +42 -8
  112. package/source/typed-array.d.ts +6 -0
  113. package/source/union-length.d.ts +27 -0
  114. package/source/union-max.d.ts +56 -0
  115. package/source/union-to-intersection.d.ts +1 -1
  116. package/source/union-to-tuple.d.ts +8 -4
  117. package/source/unwrap-required.d.ts +37 -0
  118. package/source/words.d.ts +30 -4
  119. package/source/writable.d.ts +14 -14
  120. package/source/xor.d.ts +1 -1
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/type-fest
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [type-fest](https://www.npmjs.com/package/type-fest) @ 5.5.0 |
17
- | Processed | 2026-03-19 |
16
+ | Original | [type-fest](https://www.npmjs.com/package/type-fest) @ 5.10.0 |
17
+ | Processed | 2026-09-27 |
18
18
  | Smoke test | failed |
19
19
  | Deps updated | 0 |
20
20
 
package/changes.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "bumped": {},
3
- "timestamp": "2026-03-19T08:18:39.901Z",
3
+ "timestamp": "2026-09-27T01:04:10.017Z",
4
4
  "totalUpdated": 0
5
5
  }
package/index.d.ts CHANGED
@@ -34,6 +34,7 @@ export type {OmitIndexSignature} from './source/omit-index-signature.d.ts';
34
34
  export type {PickIndexSignature} from './source/pick-index-signature.d.ts';
35
35
  export type {PartialDeep, PartialDeepOptions} from './source/partial-deep.d.ts';
36
36
  export type {UnwrapPartial} from './source/unwrap-partial.d.ts';
37
+ export type {UnwrapRequired} from './source/unwrap-required.d.ts';
37
38
  export type {RequiredDeep} from './source/required-deep.d.ts';
38
39
  export type {PickDeep} from './source/pick-deep.d.ts';
39
40
  export type {OmitDeep} from './source/omit-deep.d.ts';
@@ -52,6 +53,7 @@ export type {SetRequired} from './source/set-required.d.ts';
52
53
  export type {SetRequiredDeep} from './source/set-required-deep.d.ts';
53
54
  export type {SetNonNullable} from './source/set-non-nullable.d.ts';
54
55
  export type {SetNonNullableDeep} from './source/set-non-nullable-deep.d.ts';
56
+ export type {NonNullableDeep} from './source/non-nullable-deep.d.ts';
55
57
  export type {ValueOf} from './source/value-of.d.ts';
56
58
  export type {AsyncReturnType} from './source/async-return-type.d.ts';
57
59
  export type {ConditionalExcept} from './source/conditional-except.d.ts';
@@ -97,10 +99,12 @@ export type {LessThan} from './source/less-than.d.ts';
97
99
  export type {LessThanOrEqual} from './source/less-than-or-equal.d.ts';
98
100
  export type {Sum} from './source/sum.d.ts';
99
101
  export type {Subtract} from './source/subtract.d.ts';
102
+ export type {UnionMax} from './source/union-max.d.ts';
100
103
  export type {KeyAsString} from './source/key-as-string.d.ts';
101
104
  export type {Exact} from './source/exact.d.ts';
102
105
  export type {ReadonlyTuple} from './source/readonly-tuple.d.ts';
103
106
  export type {OverrideProperties} from './source/override-properties.d.ts';
107
+ export type {RenameKeys} from './source/rename-keys.d.ts';
104
108
  export type {OptionalKeysOf} from './source/optional-keys-of.d.ts';
105
109
  export type {IsOptionalKeyOf} from './source/is-optional-key-of.d.ts';
106
110
  export type {HasOptionalKeys} from './source/has-optional-keys.d.ts';
@@ -125,13 +129,11 @@ export type {UnionToTuple} from './source/union-to-tuple.d.ts';
125
129
  export type {IntRange} from './source/int-range.d.ts';
126
130
  export type {IntClosedRange} from './source/int-closed-range.d.ts';
127
131
  export type {IsEqual} from './source/is-equal.d.ts';
128
- export type {
129
- IsLiteral,
130
- IsStringLiteral,
131
- IsNumericLiteral,
132
- IsBooleanLiteral,
133
- IsSymbolLiteral,
134
- } from './source/is-literal.d.ts';
132
+ export type {IsLiteral} from './source/is-literal.d.ts';
133
+ export type {IsStringLiteral} from './source/is-string-literal.d.ts';
134
+ export type {IsNumericLiteral} from './source/is-numeric-literal.d.ts';
135
+ export type {IsBooleanLiteral} from './source/is-boolean-literal.d.ts';
136
+ export type {IsSymbolLiteral} from './source/is-symbol-literal.d.ts';
135
137
  export type {IsAny} from './source/is-any.d.ts';
136
138
  export type {IfAny} from './source/if-any.d.ts';
137
139
  export type {IsNever} from './source/is-never.d.ts';
@@ -173,6 +175,9 @@ export type {TupleOf} from './source/tuple-of.d.ts';
173
175
  export type {ExclusifyUnion} from './source/exclusify-union.d.ts';
174
176
  export type {ArrayReverse} from './source/array-reverse.d.ts';
175
177
  export type {UnionMember} from './source/union-member.d.ts';
178
+ export type {Absolute} from './source/absolute.d.ts';
179
+ export type {UnionLength} from './source/union-length.d.ts';
180
+ export type {StringToNumber} from './source/string-to-number.d.ts';
176
181
 
177
182
  // Template literal types
178
183
  export type {CamelCase, CamelCaseOptions} from './source/camel-case.d.ts';
@@ -203,6 +208,9 @@ export type {LastArrayElement} from './source/last-array-element.d.ts';
203
208
  export type {ConditionalSimplify} from './source/conditional-simplify.d.ts';
204
209
  export type {ConditionalSimplifyDeep} from './source/conditional-simplify-deep.d.ts';
205
210
  export type {RemovePrefix, RemovePrefixOptions} from './source/remove-prefix.d.ts';
211
+ export type {RemoveSuffix, RemoveSuffixOptions} from './source/remove-suffix.d.ts';
212
+ export type {StringToArray, StringToArrayOptions} from './source/string-to-array.d.ts';
213
+ export type {StringLength} from './source/string-length.d.ts';
206
214
 
207
215
  // Miscellaneous
208
216
  export type {GlobalThis} from './source/global-this.d.ts';
@@ -210,9 +218,10 @@ export type {PackageJson} from './source/package-json.d.ts';
210
218
  export type {TsConfigJson} from './source/tsconfig-json.d.ts';
211
219
 
212
220
  // Improved built-in
213
- export type {ExtendsStrict} from './source/extends-strict.d.ts';
221
+ export type {ExtendsStrict, ExtendsStrictOptions} from './source/extends-strict.d.ts';
214
222
  export type {ExtractStrict} from './source/extract-strict.d.ts';
215
223
  export type {ExcludeStrict} from './source/exclude-strict.d.ts';
216
224
  export type {ExcludeExactly} from './source/exclude-exactly.d.ts';
225
+ export type {ExtractExactly} from './source/extract-exactly.d.ts';
217
226
 
218
227
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/type-fest",
3
- "version": "5.5.0-depup.0",
3
+ "version": "5.10.0-depup.0",
4
4
  "description": "A collection of essential TypeScript types (with updated dependencies)",
5
5
  "license": "(MIT OR CC0-1.0)",
6
6
  "repository": "sindresorhus/type-fest",
@@ -26,8 +26,9 @@
26
26
  },
27
27
  "scripts": {
28
28
  "test:tsc": "node --max-old-space-size=6144 ./node_modules/.bin/tsc",
29
+ "test:minimum-lib": "node --max-old-space-size=6144 ./node_modules/.bin/tsc -p tsconfig.minimum-lib.json",
29
30
  "test:tsd": "node --max-old-space-size=6144 ./node_modules/.bin/tsd",
30
- "test:xo": "node --max-old-space-size=6144 ./node_modules/.bin/xo --ignores=lint-processors/fixtures/**/*.d.ts",
31
+ "test:xo": "node --max-old-space-size=6144 ./node_modules/.bin/xo --ignores=lint-processors/fixtures/**/*.d.ts '**/*.{js,ts,md}'",
31
32
  "test:linter": "node --test",
32
33
  "test": "run-p test:*"
33
34
  },
@@ -61,17 +62,19 @@
61
62
  "tagged-tag": "^1.0.0"
62
63
  },
63
64
  "devDependencies": {
65
+ "@eslint/markdown": "^8.0.1",
64
66
  "@sindresorhus/tsconfig": "^8.0.1",
67
+ "@types/node": "^25.5.0",
65
68
  "@typescript-eslint/parser": "^8.44.0",
66
- "eslint": "^9.35.0",
67
69
  "@typescript/vfs": "^1.6.1",
68
70
  "dedent": "^1.7.0",
71
+ "eslint": "^10.1.0",
69
72
  "expect-type": "^1.2.2",
70
73
  "npm-run-all2": "^8.0.4",
71
74
  "tsd": "^0.33.0",
72
75
  "typescript": "^5.9.2",
73
76
  "typescript-eslint": "^8.47.0",
74
- "xo": "^1.2.2"
77
+ "xo": "^2.0.2"
75
78
  },
76
79
  "tsd": {
77
80
  "compilerOptions": {
@@ -82,8 +85,8 @@
82
85
  "changes": {},
83
86
  "depsUpdated": 0,
84
87
  "originalPackage": "type-fest",
85
- "originalVersion": "5.5.0",
86
- "processedAt": "2026-03-19T08:18:48.269Z",
88
+ "originalVersion": "5.10.0",
89
+ "processedAt": "2026-09-27T01:04:16.083Z",
87
90
  "smokeTest": "failed"
88
91
  }
89
92
  }
package/readme.md CHANGED
@@ -102,73 +102,76 @@ Click the type names for complete docs.
102
102
  - [`UnknownArray`](source/unknown-array.d.ts) - Represents an array with `unknown` value.
103
103
  - [`UnknownMap`](source/unknown-map.d.ts) - Represents a map with `unknown` key and value.
104
104
  - [`UnknownSet`](source/unknown-set.d.ts) - Represents a set with `unknown` value.
105
- - [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys).
105
+ - [`Except`](source/except.d.ts) - Create a type from an object type without certain keys.
106
106
  - [`Writable`](source/writable.d.ts) - Create a type that strips `readonly` from the given type. Inverse of `Readonly<T>`.
107
107
  - [`WritableDeep`](source/writable-deep.d.ts) - Create a deeply mutable version of an `object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray` type. The inverse of `ReadonlyDeep<T>`. Use `Writable<T>` if you only need one level deep.
108
108
  - [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
109
109
  - [`ObjectMerge`](source/object-merge.d.ts) - Merge two object types into a new object type, where keys from the second override keys from the first.
110
110
  - [`MergeDeep`](source/merge-deep.d.ts) - Merge two objects or two arrays/tuples recursively into a new type.
111
111
  - [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.
112
- - [`OverrideProperties`](source/override-properties.d.ts) - Override only existing properties of the given type. Similar to `Merge`, but enforces that the original type has the properties you want to override.
113
- - [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.
114
- - [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.
115
- - [`RequireAllOrNone`](source/require-all-or-none.d.ts) - Create a type that requires all of the given keys or none of the given keys.
116
- - [`RequireOneOrNone`](source/require-one-or-none.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more, or none of the given keys.
112
+ - [`OverrideProperties`](source/override-properties.d.ts) - Override existing properties of the given type. Similar to `Merge`, but enforces that the original type has the properties you want to override.
113
+ - [`RenameKeys`](source/rename-keys.d.ts) - Rename keys in an object type according to a map of old-to-new names.
114
+ - [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys, while keeping the remaining keys as is.
115
+ - [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly one of the given keys and disallows more, while keeping the remaining keys as is.
116
+ - [`RequireAllOrNone`](source/require-all-or-none.d.ts) - Create a type that requires all of the given keys or none of the given keys, while keeping the remaining keys as is.
117
+ - [`RequireOneOrNone`](source/require-one-or-none.d.ts) - Create a type that requires exactly one of the given keys or none of the given keys, while keeping the remaining keys as is.
117
118
  - [`SingleKeyObject`](source/single-key-object.d.ts) - Create a type that only accepts an object with a single key.
118
- - [`RequiredDeep`](source/required-deep.d.ts) - Create a deeply required version of another type. Use [`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype) if you only need one level deep.
119
- - [`PickDeep`](source/pick-deep.d.ts) - Pick properties from a deeply-nested object. Use [`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys) if you only need one level deep.
120
- - [`OmitDeep`](source/omit-deep.d.ts) - Omit properties from a deeply-nested object. Use [`Omit<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) if you only need one level deep.
119
+ - [`RequiredDeep`](source/required-deep.d.ts) - Create a deeply required version of another type.
120
+ - [`PickDeep`](source/pick-deep.d.ts) - Pick properties from a deeply-nested object.
121
+ - [`OmitDeep`](source/omit-deep.d.ts) - Omit properties from a deeply-nested object.
121
122
  - [`OmitIndexSignature`](source/omit-index-signature.d.ts) - Omit any index signatures from the given object type, leaving only explicitly defined properties.
122
123
  - [`PickIndexSignature`](source/pick-index-signature.d.ts) - Pick only index signatures from the given object type, leaving out all explicitly defined properties.
123
- - [`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.
124
+ - [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type.
124
125
  - [`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts) - Create a deep version of another type where all keys accepting `undefined` type are set to optional.
125
126
  - [`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts) - Create a deep version of another type where all optional keys are set to also accept `undefined`.
126
127
  - [`UnwrapPartial`](source/unwrap-partial.d.ts) - Revert the `Partial` modifier on an object type.
127
- - [`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.
128
- - [`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).
129
- - [`Tagged`](source/tagged.d.ts) - Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) that can support [multiple tags](https://github.com/sindresorhus/type-fest/issues/665) and [per-tag metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). (This replaces the previous [`Opaque`](source/tagged.d.ts) type, which is now deprecated.)
130
- - [`UnwrapTagged`](source/tagged.d.ts) - Get the untagged portion of a tagged type created with `Tagged`. (This replaces the previous [`UnwrapOpaque`](source/tagged.d.ts) type, which is now deprecated.)
128
+ - [`UnwrapRequired`](source/unwrap-required.d.ts) - Revert the `Required` modifier on an object type.
129
+ - [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of another type.
130
+ - [`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.
131
+ - [`Tagged`](source/tagged.d.ts) - Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) that can support [multiple tags](https://github.com/sindresorhus/type-fest/issues/665) and [per-tag metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf).
132
+ - [`UnwrapTagged`](source/tagged.d.ts) - Get the untagged portion of a tagged type created with `Tagged`.
131
133
  - [`InvariantOf`](source/invariant-of.d.ts) - Create an [invariant type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance), which is a type that does not accept supertypes and subtypes.
132
- - [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.
133
- - [`SetReadonly`](source/set-readonly.d.ts) - Create a type that makes the given keys readonly.
134
- - [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.
135
- - [`SetRequiredDeep`](source/set-required-deep.d.ts) - Like `SetRequired` except it selects the keys deeply.
136
- - [`SetNonNullable`](source/set-non-nullable.d.ts) - Create a type that makes the given keys non-nullable.
134
+ - [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional, while keeping the remaining keys as is.
135
+ - [`SetReadonly`](source/set-readonly.d.ts) - Create a type that makes the given keys readonly, while keeping the remaining keys as is.
136
+ - [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required, while keeping the remaining keys as is.
137
+ - [`SetRequiredDeep`](source/set-required-deep.d.ts) - Create a type that makes the given keys required, with support for deeply nested key paths, while keeping the remaining keys as is.
138
+ - [`SetNonNullable`](source/set-non-nullable.d.ts) - Create a type that makes the given keys non-nullable, while keeping the remaining keys as is.
137
139
  - [`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts) - Create a type that makes the specified keys non-nullable (removes `null` and `undefined`), supports deeply nested key paths, and leaves all other keys unchanged.
140
+ - [`NonNullableDeep`](source/non-nullable-deep.d.ts) - Recursively removes `null` and `undefined` from the specified type.
138
141
  - [`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.
139
- - [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.
140
- - [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.
141
- - [`ConditionalPickDeep`](source/conditional-pick-deep.d.ts) - Like `ConditionalPick` except that it selects the properties deeply.
142
- - [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.
142
+ - [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract the keys from a type where the value type of the key extends the given `Condition`.
143
+ - [`ConditionalPick`](source/conditional-pick.d.ts) - Pick keys from the shape that matches the given `Condition`.
144
+ - [`ConditionalPickDeep`](source/conditional-pick-deep.d.ts) - Pick keys recursively from the shape that matches the given condition.
145
+ - [`ConditionalExcept`](source/conditional-except.d.ts) - Exclude keys from a shape that matches the given `Condition`.
143
146
  - [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.
144
- - [`LiteralToPrimitive`](source/literal-to-primitive.d.ts) - Convert a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) to the [primitive type](source/primitive.d.ts) it belongs to.
147
+ - [`LiteralToPrimitive`](source/literal-to-primitive.d.ts) - Given a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) return the [primitive type](https://developer.mozilla.org/en-US/docs/Glossary/Primitive) it belongs to, or `never` if it's not a primitive.
145
148
  - [`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts) - Like `LiteralToPrimitive` except it converts literal types inside an object or array deeply.
146
149
  - [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.
147
150
  - [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, `Array`, `Set`, `Map`, generator, stream, etc.
148
- - [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection.
149
- - [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection.
151
+ - [`Entry`](source/entry.d.ts) - Create a type that describes a single key-value pair produced when calling a collection’s `entries` method.
152
+ - [`Entries`](source/entries.d.ts) - Create a type that describes the key-value pairs produced when calling a collection’s `entries` method.
150
153
  - [`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.
151
154
  - [`SetParameterType`](source/set-parameter-type.d.ts) - Create a function that replaces some parameters with the given parameters.
152
155
  - [`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.
153
156
  - [`SimplifyDeep`](source/simplify-deep.d.ts) - Deeply simplifies an object type.
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.
157
+ - [`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#get) function.
155
158
  - [`KeyAsString`](source/key-as-string.d.ts) - Get keys of the given type as strings.
156
159
  - [`Schema`](source/schema.d.ts) - Create a deep version of another object type where property values are recursively replaced into a given value type.
157
- - [`Exact`](source/exact.d.ts) - Create a type that does not allow extra properties.
160
+ - [`Exact`](source/exact.d.ts) - Create a type that does not allow extra properties, meaning it only allows properties that are explicitly declared.
158
161
  - [`KeysOfUnion`](source/keys-of-union.d.ts) - Create a union of all keys from a given type, even those exclusive to specific union members.
159
162
  - [`OptionalKeysOf`](source/optional-keys-of.d.ts) - Extract all optional keys from the given type.
160
- - [`HasOptionalKeys`](source/has-optional-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any optional fields.
163
+ - [`HasOptionalKeys`](source/has-optional-keys.d.ts) - Returns a boolean for whether the given type has any optional fields.
161
164
  - [`RequiredKeysOf`](source/required-keys-of.d.ts) - Extract all required keys from the given type.
162
- - [`HasRequiredKeys`](source/has-required-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any required fields.
165
+ - [`HasRequiredKeys`](source/has-required-keys.d.ts) - Returns a boolean for whether the given type has any required fields.
163
166
  - [`ReadonlyKeysOf`](source/readonly-keys-of.d.ts) - Extract all readonly keys from the given type.
164
- - [`HasReadonlyKeys`](source/has-readonly-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any readonly fields.
165
- - [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all writable (non-readonly) keys from the given type.
166
- - [`HasWritableKeys`](source/has-writable-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any writable fields.
167
+ - [`HasReadonlyKeys`](source/has-readonly-keys.d.ts) - Returns a boolean for whether the given type has any readonly fields.
168
+ - [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all writable keys from the given type.
169
+ - [`HasWritableKeys`](source/has-writable-keys.d.ts) - Returns a boolean for whether the given type has any writable fields.
167
170
  - [`Spread`](source/spread.d.ts) - Mimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax.
168
171
  - [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal.
169
172
  - [`TaggedUnion`](source/tagged-union.d.ts) - Create a union of types that share a common discriminant property.
170
- - [`IntRange`](source/int-range.d.ts) - Generate a union of numbers (includes the start and excludes the end).
171
- - [`IntClosedRange`](source/int-closed-range.d.ts) - Generate a union of numbers (includes the start and the end).
173
+ - [`IntRange`](source/int-range.d.ts) - Generate a union of numbers between a specified start (inclusive) and end (exclusive), with an optional step.
174
+ - [`IntClosedRange`](source/int-closed-range.d.ts) - Generate a union of numbers between a specified start and end (both inclusive), with an optional step.
172
175
  - [`ArrayIndices`](source/array-indices.d.ts) - Provides valid indices for a constant array or tuple.
173
176
  - [`ArrayValues`](source/array-values.d.ts) - Provides all values for a constant array or tuple.
174
177
  - [`ArraySplice`](source/array-splice.d.ts) - Create a new array type by adding or removing elements at a specified index range in the original array.
@@ -179,7 +182,7 @@ Click the type names for complete docs.
179
182
  - [`SharedUnionFieldsDeep`](source/shared-union-fields-deep.d.ts) - Create a type with shared fields from a union of object types, deeply traversing nested structures.
180
183
  - [`AllUnionFields`](source/all-union-fields.d.ts) - Create a type with all fields from a union of object types.
181
184
  - [`DistributedOmit`](source/distributed-omit.d.ts) - Omits keys from a type, distributing the operation over a union.
182
- - [`DistributedPick`](source/distributed-pick.d.ts) - Picks keys from a type, distributing the operation over a union.
185
+ - [`DistributedPick`](source/distributed-pick.d.ts) - Pick keys from a type, distributing the operation over a union.
183
186
  - [`And`](source/and.d.ts) - Returns a boolean for whether two given types are both `true`.
184
187
  - [`Or`](source/or.d.ts) - Returns a boolean for whether either of two given types is `true`.
185
188
  - [`Xor`](source/xor.d.ts) - Returns a boolean for whether only one of two given types is `true`.
@@ -196,15 +199,16 @@ Click the type names for complete docs.
196
199
  - [`ExclusifyUnion`](source/exclusify-union.d.ts) - Ensure mutual exclusivity in object unions by adding other members’ keys as `?: never`.
197
200
  - [`Optional`](source/optional.d.ts) - Create a type that represents either the value or `undefined`, while stripping `null` from the type.
198
201
  - [`UnionMember`](source/union-member.d.ts) - Returns an arbitrary member of a union type.
202
+ - [`UnionLength`](source/union-length.d.ts) - Returns the length of a union type.
199
203
 
200
204
  ### Type Guard
201
205
 
202
206
  - [`If`](source/if.d.ts) - An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
203
207
  - [`IsLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
204
- - [`IsStringLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
205
- - [`IsNumericLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
206
- - [`IsBooleanLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
207
- - [`IsSymbolLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
208
+ - [`IsStringLiteral`](source/is-string-literal.d.ts) - Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
209
+ - [`IsNumericLiteral`](source/is-numeric-literal.d.ts) - Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
210
+ - [`IsBooleanLiteral`](source/is-boolean-literal.d.ts) - Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
211
+ - [`IsSymbolLiteral`](source/is-symbol-literal.d.ts) - Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
208
212
  - [`IsAny`](source/is-any.d.ts) - Returns a boolean for whether the given type is `any`.
209
213
  - [`IsNever`](source/is-never.d.ts) - Returns a boolean for whether the given type is `never`.
210
214
  - [`IsUnknown`](source/is-unknown.d.ts) - Returns a boolean for whether the given type is `unknown`.
@@ -226,7 +230,7 @@ Click the type names for complete docs.
226
230
 
227
231
  - [`Jsonify`](source/jsonify.d.ts) - Transform a type to one that is assignable to the `JsonValue` type.
228
232
  - [`Jsonifiable`](source/jsonifiable.d.ts) - Matches a value that can be losslessly converted to JSON.
229
- - [`JsonPrimitive`](source/json-value.d.ts) - Matches a JSON primitive.
233
+ - [`JsonPrimitive`](source/json-value.d.ts) - Matches any valid JSON primitive value.
230
234
  - [`JsonObject`](source/json-value.d.ts) - Matches a JSON object.
231
235
  - [`JsonArray`](source/json-value.d.ts) - Matches a JSON array.
232
236
  - [`JsonValue`](source/json-value.d.ts) - Matches any valid JSON value.
@@ -239,17 +243,20 @@ Click the type names for complete docs.
239
243
 
240
244
  - [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
241
245
  - [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
242
- - [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.
246
+ - [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type, by boxing the return type in `Promise` while keeping the same parameter types.
243
247
 
244
248
  ### String
245
249
 
246
250
  - [`Trim`](source/trim.d.ts) - Remove leading and trailing spaces from a string.
247
251
  - [`Split`](source/split.d.ts) - Represents an array of strings split using a given character or character set.
248
- - [`Words`](source/words.d.ts) - Represents an array of strings split using a heuristic for detecting words.
252
+ - [`Words`](source/words.d.ts) - Split a string similar to Lodash's `_.words()` function.
249
253
  - [`Replace`](source/replace.d.ts) - Represents a string with some or all matches replaced by a replacement.
250
254
  - [`StringSlice`](source/string-slice.d.ts) - Returns a string slice of a given range, just like `String#slice()`.
251
255
  - [`StringRepeat`](source/string-repeat.d.ts) - Returns a new string which contains the specified number of copies of a given string, just like `String#repeat()`.
252
256
  - [`RemovePrefix`](source/remove-prefix.d.ts) - Remove the specified prefix from the start of a string.
257
+ - [`RemoveSuffix`](source/remove-suffix.d.ts) - Remove the specified suffix from the end of a string.
258
+ - [`StringToArray`](source/string-to-array.d.ts) - Returns an array of the characters of the specified string.
259
+ - [`StringLength`](source/string-length.d.ts) - Returns the length of the given string.
253
260
 
254
261
  ### Array
255
262
 
@@ -260,8 +267,8 @@ Click the type names for complete docs.
260
267
  - [`ArrayElement`](source/array-element.d.ts) - Extracts the element type of an array or tuple.
261
268
  - [`LastArrayElement`](source/last-array-element.d.ts) - Extract the type of the last element of an array.
262
269
  - [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length. The `Array` prototype methods that manipulate its length are excluded from the resulting type.
263
- - [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimensions.
264
- - [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimensions.
270
+ - [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimension.
271
+ - [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimension.
265
272
  - [`ReadonlyTuple`](source/readonly-tuple.d.ts) - Create a type that represents a read-only tuple of the given type and length.
266
273
  - [`TupleToUnion`](source/tuple-to-union.d.ts) - Convert a tuple/array into a union type of its elements.
267
274
  - [`UnionToTuple`](source/union-to-tuple.d.ts) - Convert a union type into an unordered tuple type of its elements.
@@ -287,29 +294,32 @@ Click the type names for complete docs.
287
294
  - [`NonNegativeInteger`](source/numeric.d.ts) - A non-negative (`0 <= x < ∞`) `number` that is an integer.
288
295
  - [`IsNegative`](source/numeric.d.ts) - Returns a boolean for whether the given number is a negative number.
289
296
  - [`IsFloat`](source/is-float.d.ts) - Returns a boolean for whether the given number is a float, like `1.5` or `-1.5`.
290
- - [`IsInteger`](source/is-integer.d.ts) - Returns a boolean for whether the given number is an integer, like `-5`, `1.0` or `100`.
297
+ - [`IsInteger`](source/is-integer.d.ts) - Returns a boolean for whether the given number is an integer, like `-5`, `1.0`, or `100`.
291
298
  - [`GreaterThan`](source/greater-than.d.ts) - Returns a boolean for whether a given number is greater than another number.
292
299
  - [`GreaterThanOrEqual`](source/greater-than-or-equal.d.ts) - Returns a boolean for whether a given number is greater than or equal to another number.
293
300
  - [`LessThan`](source/less-than.d.ts) - Returns a boolean for whether a given number is less than another number.
294
301
  - [`LessThanOrEqual`](source/less-than-or-equal.d.ts) - Returns a boolean for whether a given number is less than or equal to another number.
295
302
  - [`Sum`](source/sum.d.ts) - Returns the sum of two numbers.
296
303
  - [`Subtract`](source/subtract.d.ts) - Returns the difference between two numbers.
304
+ - [`UnionMax`](source/union-max.d.ts) - Returns the maximum number in a union of numbers.
305
+ - [`Absolute`](source/absolute.d.ts) - Returns the absolute value of the specified number or bigint.
306
+ - [`StringToNumber`](source/string-to-number.d.ts) - Converts a numeric string to a number.
297
307
 
298
308
  ### Change case
299
309
 
300
- - [`CamelCase`](source/camel-case.d.ts) - Convert a string literal to camel-case (`fooBar`).
301
- - [`CamelCasedProperties`](source/camel-cased-properties.d.ts) - Convert object properties to camel-case (`fooBar`).
302
- - [`CamelCasedPropertiesDeep`](source/camel-cased-properties-deep.d.ts) - Convert object properties to camel-case recursively (`fooBar`).
303
- - [`KebabCase`](source/kebab-case.d.ts) - Convert a string literal to kebab-case (`foo-bar`).
304
- - [`KebabCasedProperties`](source/kebab-cased-properties.d.ts) - Convert object properties to kebab-case (`foo-bar`).
305
- - [`KebabCasedPropertiesDeep`](source/kebab-cased-properties-deep.d.ts) - Convert object properties to kebab-case recursively (`foo-bar`).
306
- - [`PascalCase`](source/pascal-case.d.ts) - Convert a string literal to pascal-case (`FooBar`).
307
- - [`PascalCasedProperties`](source/pascal-cased-properties.d.ts) - Convert object properties to pascal-case (`FooBar`).
308
- - [`PascalCasedPropertiesDeep`](source/pascal-cased-properties-deep.d.ts) - Convert object properties to pascal-case recursively (`FooBar`).
309
- - [`SnakeCase`](source/snake-case.d.ts) - Convert a string literal to snake-case (`foo_bar`).
310
- - [`SnakeCasedProperties`](source/snake-cased-properties.d.ts) - Convert object properties to snake-case (`foo_bar`).
311
- - [`SnakeCasedPropertiesDeep`](source/snake-cased-properties-deep.d.ts) - Convert object properties to snake-case recursively (`foo_bar`).
312
- - [`ScreamingSnakeCase`](source/screaming-snake-case.d.ts) - Convert a string literal to screaming-snake-case (`FOO_BAR`).
310
+ - [`CamelCase`](source/camel-case.d.ts) - Convert a string literal to camel-case.
311
+ - [`CamelCasedProperties`](source/camel-cased-properties.d.ts) - Convert top-level object properties to camel case.
312
+ - [`CamelCasedPropertiesDeep`](source/camel-cased-properties-deep.d.ts) - Convert object properties to camel case recursively.
313
+ - [`KebabCase`](source/kebab-case.d.ts) - Convert a string literal to kebab-case.
314
+ - [`KebabCasedProperties`](source/kebab-cased-properties.d.ts) - Convert top-level object properties to kebab case.
315
+ - [`KebabCasedPropertiesDeep`](source/kebab-cased-properties-deep.d.ts) - Convert object properties to kebab case recursively.
316
+ - [`PascalCase`](source/pascal-case.d.ts) - Convert a string literal to pascal-case.
317
+ - [`PascalCasedProperties`](source/pascal-cased-properties.d.ts) - Convert top-level object properties to pascal case.
318
+ - [`PascalCasedPropertiesDeep`](source/pascal-cased-properties-deep.d.ts) - Convert object properties to pascal case recursively.
319
+ - [`SnakeCase`](source/snake-case.d.ts) - Convert a string literal to snake-case.
320
+ - [`SnakeCasedProperties`](source/snake-cased-properties.d.ts) - Convert top-level object properties to snake case.
321
+ - [`SnakeCasedPropertiesDeep`](source/snake-cased-properties-deep.d.ts) - Convert object properties to snake case recursively.
322
+ - [`ScreamingSnakeCase`](source/screaming-snake-case.d.ts) - Convert a string literal to screaming-snake-case.
313
323
  - [`DelimiterCase`](source/delimiter-case.d.ts) - Convert a string literal to a custom string delimiter casing.
314
324
  - [`DelimiterCasedProperties`](source/delimiter-cased-properties.d.ts) - Convert object properties to a custom string delimiter casing.
315
325
  - [`DelimiterCasedPropertiesDeep`](source/delimiter-cased-properties-deep.d.ts) - Convert object properties to a custom string delimiter casing recursively.
@@ -317,15 +327,16 @@ Click the type names for complete docs.
317
327
  ### Miscellaneous
318
328
 
319
329
  - [`GlobalThis`](source/global-this.d.ts) - Declare locally scoped properties on `globalThis`.
320
- - [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). It also includes support for [TypeScript Declaration Files](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html).
330
+ - [`PackageJson`](source/package-json.d.ts) - 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.
321
331
  - [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html).
322
332
 
323
333
  ### Improved built-in
324
334
 
325
- - [`ExtendsStrict`](source/extends-strict.d.ts) - A stricter, non-distributive version of `extends` for checking whether one type is assignable to another.
335
+ - [`ExtendsStrict`](source/extends-strict.d.ts) - A customizable version of `extends` for checking whether one type is assignable to another.
326
336
  - [`ExtractStrict`](source/extract-strict.d.ts) - A stricter version of `Extract<T, U>` that ensures every member of `U` can successfully extract something from `T`.
327
337
  - [`ExcludeStrict`](source/exclude-strict.d.ts) - A stricter version of `Exclude<T, U>` that ensures every member of `U` can successfully exclude something from `T`.
328
338
  - [`ExcludeExactly`](source/exclude-exactly.d.ts) - A stricter version of `Exclude<T, U>` that excludes types only when they are exactly identical.
339
+ - [`ExtractExactly`](source/extract-exactly.d.ts) - A stricter version of `Extract<T, U>` that extracts types only when they are exactly identical.
329
340
 
330
341
  ## Declined types
331
342
 
@@ -370,6 +381,7 @@ Click the type names for complete docs.
370
381
 
371
382
  ### Extending existing types
372
383
 
384
+ <!-- eslint-disable-next-line type-fest/readme-jsdoc-sync -->
373
385
  - [`PackageJson`](source/package-json.d.ts) - There are a lot of tools that place extra configurations inside the `package.json` file. You can extend `PackageJson` to support these additional configurations.
374
386
  <details>
375
387
  <summary>
@@ -519,6 +531,8 @@ There are many advanced types most users don't know about.
519
531
  email: 'ex@mple.com',
520
532
  });
521
533
  ```
534
+
535
+ `Required<T>` can be reverted with [`UnwrapRequired`](source/unwrap-required.d.ts).
522
536
  </details>
523
537
 
524
538
  - [`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) - Make all properties in `T` readonly.
@@ -0,0 +1,52 @@
1
+ import type {StringToNumber} from './string-to-number.d.ts';
2
+
3
+ /**
4
+ Returns the absolute value of the specified number or bigint.
5
+
6
+ @example
7
+ ```
8
+ import type {Absolute} from 'type-fest';
9
+
10
+ type A = Absolute<-1>;
11
+ //=> 1
12
+
13
+ type B = Absolute<1>;
14
+ //=> 1
15
+
16
+ type C = Absolute<0>;
17
+ //=> 0
18
+
19
+ type D = Absolute<-1.025>;
20
+ //=> 1.025
21
+
22
+ type E = Absolute<-9999n>;
23
+ //=> 9999n
24
+ ```
25
+
26
+ Returns back the same type if the input is not a literal type.
27
+
28
+ @example
29
+ ```
30
+ import type {Absolute} from 'type-fest';
31
+
32
+ type A = Absolute<number>;
33
+ //=> number
34
+
35
+ type B = Absolute<bigint>;
36
+ //=> bigint
37
+
38
+ type C = Absolute<number | bigint>;
39
+ //=> number | bigint
40
+ ```
41
+
42
+ @category Numeric
43
+ */
44
+ export type Absolute<N extends number | bigint> = N extends bigint // Also, distributes `N`
45
+ ? `${N}` extends `-${infer Magnitude extends bigint}`
46
+ ? Magnitude
47
+ : N
48
+ : `${N}` extends `-${infer Magnitude}` // This doesn't use the `extends number` constraint approach because that fails with the `-Infinity` case
49
+ ? StringToNumber<Magnitude>
50
+ : N;
51
+
52
+ export {};
@@ -101,9 +101,14 @@ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
101
101
  @category Array
102
102
  */
103
103
  export type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> =
104
- _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
105
-
106
- type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray,
104
+ IfNotAnyOrNever<CollapseRestElement<TArray>, {
105
+ ifNot: _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
106
+ ifAny: false;
107
+ ifNever: false;
108
+ }>;
109
+
110
+ // Kept free of `IfNotAnyOrNever` so that it stays tail-recursive, which allows it to handle long arrays.
111
+ type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> =
107
112
  TArray extends readonly [infer First, ...infer Rest]
108
113
  ? IsNever<First> extends true
109
114
  ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true
@@ -113,7 +118,6 @@ type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllE
113
118
  : First extends Type
114
119
  ? _AllExtend<Rest, Type, Options>
115
120
  : false
116
- : true,
117
- false, false>;
121
+ : true;
118
122
 
119
123
  export {};
@@ -69,23 +69,23 @@ function displayPetInfoWithAllUnionFields(petInfo: AllUnionFields<Cat | Dog>) {
69
69
  @category Union
70
70
  */
71
71
  export type AllUnionFields<Union> =
72
- Extract<Union, NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown> | UnknownArray> extends infer SkippedMembers
73
- ? Exclude<Union, SkippedMembers> extends infer RelevantMembers
74
- ?
75
- | SkippedMembers
76
- | Simplify<
77
- // Include fields that are common in all union members
78
- SharedUnionFields<RelevantMembers> &
79
- // Include readonly fields present in any union member
80
- {
81
- readonly [P in ReadonlyKeysOfUnion<RelevantMembers>]?: ValueOfUnion<RelevantMembers, P & KeysOfUnion<RelevantMembers>>
82
- } &
83
- // Include remaining fields that are neither common nor readonly
84
- {
85
- [P in Exclude<KeysOfUnion<RelevantMembers>, ReadonlyKeysOfUnion<RelevantMembers> | keyof RelevantMembers>]?: ValueOfUnion<RelevantMembers, P>
86
- }
87
- >
88
- : never
89
- : never;
72
+ Extract<Union, NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown> | UnknownArray> extends infer SkippedMembers
73
+ ? Exclude<Union, SkippedMembers> extends infer RelevantMembers
74
+ ? // eslint-disable-line @stylistic/operator-linebreak
75
+ | SkippedMembers
76
+ | Simplify<
77
+ // Include fields that are common in all union members
78
+ SharedUnionFields<RelevantMembers>
79
+ // Include readonly fields present in any union member
80
+ & {
81
+ readonly [P in ReadonlyKeysOfUnion<RelevantMembers>]?: ValueOfUnion<RelevantMembers, P & KeysOfUnion<RelevantMembers>>
82
+ }
83
+ // Include remaining fields that are neither common nor readonly
84
+ & {
85
+ [P in Exclude<KeysOfUnion<RelevantMembers>, ReadonlyKeysOfUnion<RelevantMembers> | keyof RelevantMembers>]?: ValueOfUnion<RelevantMembers, P>
86
+ }
87
+ >
88
+ : never
89
+ : never;
90
90
 
91
91
  export {};
package/source/and.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type {AndAll} from './and-all.d.ts';
2
2
 
3
3
  /**
4
- Returns a boolean for whether two given types are both true.
4
+ Returns a boolean for whether two given types are both `true`.
5
5
 
6
6
  Use-case: Constructing complex conditional types where multiple conditions must be satisfied.
7
7