@depup/type-fest 5.4.4-depup.0 → 5.9.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.
- package/README.md +2 -2
- package/changes.json +5 -0
- package/index.d.ts +23 -8
- package/package.json +17 -11
- package/readme.md +98 -64
- package/source/absolute.d.ts +52 -0
- package/source/all-extend.d.ts +8 -7
- package/source/all-union-fields.d.ts +18 -18
- package/source/and-all.d.ts +76 -0
- package/source/and.d.ts +4 -3
- package/source/array-length.d.ts +36 -0
- package/source/array-reverse.d.ts +4 -3
- package/source/array-splice.d.ts +26 -26
- package/source/array-tail.d.ts +4 -4
- package/source/camel-case.d.ts +38 -5
- package/source/camel-cased-properties-deep.d.ts +11 -4
- package/source/camel-cased-properties.d.ts +5 -1
- package/source/conditional-keys.d.ts +1 -1
- package/source/conditional-pick-deep.d.ts +5 -3
- package/source/conditional-pick.d.ts +6 -4
- package/source/delimiter-case.d.ts +11 -9
- package/source/delimiter-cased-properties-deep.d.ts +8 -1
- package/source/delimiter-cased-properties.d.ts +5 -1
- package/source/empty-object.d.ts +1 -1
- package/source/entries.d.ts +1 -1
- package/source/entry.d.ts +1 -1
- package/source/exclude-exactly.d.ts +57 -0
- package/source/exclude-rest-element.d.ts +4 -4
- package/source/exclusify-union.d.ts +4 -4
- package/source/extends-strict.d.ts +129 -22
- package/source/extract-exactly.d.ts +56 -0
- package/source/get.d.ts +1 -1
- package/source/greater-than-or-equal.d.ts +34 -1
- package/source/greater-than.d.ts +37 -3
- package/source/has-optional-keys.d.ts +1 -1
- package/source/has-readonly-keys.d.ts +1 -1
- package/source/has-required-keys.d.ts +1 -1
- package/source/has-writable-keys.d.ts +1 -1
- package/source/int-closed-range.d.ts +1 -3
- package/source/int-range.d.ts +3 -5
- package/source/internal/array.d.ts +8 -15
- package/source/internal/keys.d.ts +9 -9
- package/source/internal/numeric.d.ts +19 -27
- package/source/internal/object.d.ts +44 -6
- package/source/internal/string.d.ts +1 -76
- package/source/internal/tuple.d.ts +3 -3
- package/source/internal/type.d.ts +16 -9
- package/source/is-boolean-literal.d.ts +39 -0
- package/source/is-equal.d.ts +0 -1
- package/source/is-integer.d.ts +8 -8
- package/source/is-literal.d.ts +43 -267
- package/source/is-numeric-literal.d.ts +50 -0
- package/source/is-string-literal.d.ts +72 -0
- package/source/is-symbol-literal.d.ts +39 -0
- package/source/is-union.d.ts +12 -12
- package/source/iterable-element.d.ts +5 -5
- package/source/jsonify.d.ts +5 -9
- package/source/kebab-case.d.ts +1 -0
- package/source/kebab-cased-properties-deep.d.ts +7 -0
- package/source/kebab-cased-properties.d.ts +5 -1
- package/source/keys-of-union.d.ts +2 -2
- package/source/last-array-element.d.ts +66 -13
- package/source/less-than-or-equal.d.ts +40 -4
- package/source/less-than.d.ts +35 -3
- package/source/literal-to-primitive.d.ts +1 -1
- package/source/literal-union.d.ts +1 -1
- package/source/merge-exclusive.d.ts +3 -3
- package/source/merge.d.ts +25 -0
- package/source/multidimensional-array.d.ts +1 -1
- package/source/multidimensional-readonly-array.d.ts +1 -1
- package/source/non-nullable-deep.d.ts +102 -0
- package/source/numeric.d.ts +3 -3
- package/source/object-merge.d.ts +21 -16
- package/source/omit-deep.d.ts +22 -23
- package/source/optional.d.ts +31 -0
- package/source/or-all.d.ts +73 -0
- package/source/or.d.ts +4 -11
- package/source/package-json.d.ts +7 -7
- package/source/partial-deep.d.ts +3 -1
- package/source/pascal-case.d.ts +1 -0
- package/source/pascal-cased-properties-deep.d.ts +7 -0
- package/source/pascal-cased-properties.d.ts +5 -1
- package/source/pick-deep.d.ts +8 -21
- package/source/readonly-deep.d.ts +5 -3
- package/source/remove-prefix.d.ts +16 -34
- package/source/remove-suffix.d.ts +114 -0
- package/source/rename-keys.d.ts +163 -0
- package/source/replace.d.ts +2 -2
- package/source/require-all-or-none.d.ts +5 -5
- package/source/require-at-least-one.d.ts +9 -11
- package/source/require-exactly-one.d.ts +7 -7
- package/source/require-one-or-none.d.ts +5 -5
- package/source/required-deep.d.ts +3 -1
- package/source/schema.d.ts +16 -8
- package/source/screaming-snake-case.d.ts +1 -0
- package/source/set-non-nullable-deep.d.ts +8 -4
- package/source/set-non-nullable.d.ts +4 -11
- package/source/set-optional.d.ts +6 -10
- package/source/set-parameter-type.d.ts +2 -2
- package/source/set-readonly.d.ts +4 -8
- package/source/set-required-deep.d.ts +3 -2
- package/source/set-required.d.ts +4 -8
- package/source/shared-union-fields-deep.d.ts +5 -4
- package/source/shared-union-fields.d.ts +9 -9
- package/source/snake-case.d.ts +1 -0
- package/source/snake-cased-properties-deep.d.ts +7 -0
- package/source/snake-cased-properties.d.ts +5 -1
- package/source/some-extend.d.ts +115 -0
- package/source/split-on-rest-element.d.ts +6 -4
- package/source/split.d.ts +1 -1
- package/source/spread.d.ts +1 -5
- package/source/string-length.d.ts +38 -0
- package/source/string-repeat.d.ts +48 -21
- package/source/string-slice.d.ts +1 -1
- package/source/string-to-array.d.ts +97 -0
- package/source/string-to-number.d.ts +67 -0
- package/source/subtract.d.ts +4 -3
- package/source/sum.d.ts +5 -4
- package/source/tagged.d.ts +5 -7
- package/source/tsconfig-json.d.ts +40 -8
- package/source/tuple-of.d.ts +42 -8
- package/source/typed-array.d.ts +1 -0
- package/source/union-length.d.ts +27 -0
- package/source/union-member.d.ts +65 -0
- package/source/union-to-intersection.d.ts +1 -1
- package/source/union-to-tuple.d.ts +10 -19
- package/source/unwrap-required.d.ts +37 -0
- package/source/words.d.ts +30 -4
- package/source/writable.d.ts +15 -19
- 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.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [type-fest](https://www.npmjs.com/package/type-fest) @ 5.9.0 |
|
|
17
|
+
| Processed | 2026-09-06 |
|
|
18
18
|
| Smoke test | failed |
|
|
19
19
|
| Deps updated | 0 |
|
|
20
20
|
|
package/changes.json
ADDED
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';
|
|
@@ -43,6 +44,7 @@ export type {ReadonlyDeep} from './source/readonly-deep.d.ts';
|
|
|
43
44
|
export type {LiteralUnion} from './source/literal-union.d.ts';
|
|
44
45
|
export type {Promisable} from './source/promisable.d.ts';
|
|
45
46
|
export type {Arrayable} from './source/arrayable.d.ts';
|
|
47
|
+
export type {Optional} from './source/optional.d.ts';
|
|
46
48
|
export type {Opaque, UnwrapOpaque, Tagged, GetTagMetadata, UnwrapTagged} from './source/tagged.d.ts';
|
|
47
49
|
export type {InvariantOf} from './source/invariant-of.d.ts';
|
|
48
50
|
export type {SetOptional} from './source/set-optional.d.ts';
|
|
@@ -51,6 +53,7 @@ export type {SetRequired} from './source/set-required.d.ts';
|
|
|
51
53
|
export type {SetRequiredDeep} from './source/set-required-deep.d.ts';
|
|
52
54
|
export type {SetNonNullable} from './source/set-non-nullable.d.ts';
|
|
53
55
|
export type {SetNonNullableDeep} from './source/set-non-nullable-deep.d.ts';
|
|
56
|
+
export type {NonNullableDeep} from './source/non-nullable-deep.d.ts';
|
|
54
57
|
export type {ValueOf} from './source/value-of.d.ts';
|
|
55
58
|
export type {AsyncReturnType} from './source/async-return-type.d.ts';
|
|
56
59
|
export type {ConditionalExcept} from './source/conditional-except.d.ts';
|
|
@@ -100,6 +103,7 @@ export type {KeyAsString} from './source/key-as-string.d.ts';
|
|
|
100
103
|
export type {Exact} from './source/exact.d.ts';
|
|
101
104
|
export type {ReadonlyTuple} from './source/readonly-tuple.d.ts';
|
|
102
105
|
export type {OverrideProperties} from './source/override-properties.d.ts';
|
|
106
|
+
export type {RenameKeys} from './source/rename-keys.d.ts';
|
|
103
107
|
export type {OptionalKeysOf} from './source/optional-keys-of.d.ts';
|
|
104
108
|
export type {IsOptionalKeyOf} from './source/is-optional-key-of.d.ts';
|
|
105
109
|
export type {HasOptionalKeys} from './source/has-optional-keys.d.ts';
|
|
@@ -124,13 +128,11 @@ export type {UnionToTuple} from './source/union-to-tuple.d.ts';
|
|
|
124
128
|
export type {IntRange} from './source/int-range.d.ts';
|
|
125
129
|
export type {IntClosedRange} from './source/int-closed-range.d.ts';
|
|
126
130
|
export type {IsEqual} from './source/is-equal.d.ts';
|
|
127
|
-
export type {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
IsSymbolLiteral,
|
|
133
|
-
} from './source/is-literal.d.ts';
|
|
131
|
+
export type {IsLiteral} from './source/is-literal.d.ts';
|
|
132
|
+
export type {IsStringLiteral} from './source/is-string-literal.d.ts';
|
|
133
|
+
export type {IsNumericLiteral} from './source/is-numeric-literal.d.ts';
|
|
134
|
+
export type {IsBooleanLiteral} from './source/is-boolean-literal.d.ts';
|
|
135
|
+
export type {IsSymbolLiteral} from './source/is-symbol-literal.d.ts';
|
|
134
136
|
export type {IsAny} from './source/is-any.d.ts';
|
|
135
137
|
export type {IfAny} from './source/if-any.d.ts';
|
|
136
138
|
export type {IsNever} from './source/is-never.d.ts';
|
|
@@ -144,6 +146,7 @@ export type {ArraySlice} from './source/array-slice.d.ts';
|
|
|
144
146
|
export type {ArraySplice} from './source/array-splice.d.ts';
|
|
145
147
|
export type {ArrayTail} from './source/array-tail.d.ts';
|
|
146
148
|
export type {ArrayElement} from './source/array-element.d.ts';
|
|
149
|
+
export type {ArrayLength} from './source/array-length.d.ts';
|
|
147
150
|
export type {SetFieldType, SetFieldTypeOptions} from './source/set-field-type.d.ts';
|
|
148
151
|
export type {Paths, PathsOptions} from './source/paths.d.ts';
|
|
149
152
|
export type {AllUnionFields} from './source/all-union-fields.d.ts';
|
|
@@ -153,9 +156,12 @@ export type {IsNull} from './source/is-null.d.ts';
|
|
|
153
156
|
export type {IfNull} from './source/if-null.d.ts';
|
|
154
157
|
export type {IsUndefined} from './source/is-undefined.d.ts';
|
|
155
158
|
export type {And} from './source/and.d.ts';
|
|
159
|
+
export type {AndAll} from './source/and-all.d.ts';
|
|
156
160
|
export type {Or} from './source/or.d.ts';
|
|
161
|
+
export type {OrAll} from './source/or-all.d.ts';
|
|
157
162
|
export type {Xor} from './source/xor.d.ts';
|
|
158
163
|
export type {AllExtend, AllExtendOptions} from './source/all-extend.d.ts';
|
|
164
|
+
export type {SomeExtend, SomeExtendOptions} from './source/some-extend.d.ts';
|
|
159
165
|
export type {NonEmptyTuple} from './source/non-empty-tuple.d.ts';
|
|
160
166
|
export type {FindGlobalInstanceType, FindGlobalType} from './source/find-global-type.d.ts';
|
|
161
167
|
export type {If} from './source/if.d.ts';
|
|
@@ -167,6 +173,10 @@ export type {IsNullable} from './source/is-nullable.d.ts';
|
|
|
167
173
|
export type {TupleOf} from './source/tuple-of.d.ts';
|
|
168
174
|
export type {ExclusifyUnion} from './source/exclusify-union.d.ts';
|
|
169
175
|
export type {ArrayReverse} from './source/array-reverse.d.ts';
|
|
176
|
+
export type {UnionMember} from './source/union-member.d.ts';
|
|
177
|
+
export type {Absolute} from './source/absolute.d.ts';
|
|
178
|
+
export type {UnionLength} from './source/union-length.d.ts';
|
|
179
|
+
export type {StringToNumber} from './source/string-to-number.d.ts';
|
|
170
180
|
|
|
171
181
|
// Template literal types
|
|
172
182
|
export type {CamelCase, CamelCaseOptions} from './source/camel-case.d.ts';
|
|
@@ -197,6 +207,9 @@ export type {LastArrayElement} from './source/last-array-element.d.ts';
|
|
|
197
207
|
export type {ConditionalSimplify} from './source/conditional-simplify.d.ts';
|
|
198
208
|
export type {ConditionalSimplifyDeep} from './source/conditional-simplify-deep.d.ts';
|
|
199
209
|
export type {RemovePrefix, RemovePrefixOptions} from './source/remove-prefix.d.ts';
|
|
210
|
+
export type {RemoveSuffix, RemoveSuffixOptions} from './source/remove-suffix.d.ts';
|
|
211
|
+
export type {StringToArray, StringToArrayOptions} from './source/string-to-array.d.ts';
|
|
212
|
+
export type {StringLength} from './source/string-length.d.ts';
|
|
200
213
|
|
|
201
214
|
// Miscellaneous
|
|
202
215
|
export type {GlobalThis} from './source/global-this.d.ts';
|
|
@@ -204,8 +217,10 @@ export type {PackageJson} from './source/package-json.d.ts';
|
|
|
204
217
|
export type {TsConfigJson} from './source/tsconfig-json.d.ts';
|
|
205
218
|
|
|
206
219
|
// Improved built-in
|
|
207
|
-
export type {ExtendsStrict} from './source/extends-strict.d.ts';
|
|
220
|
+
export type {ExtendsStrict, ExtendsStrictOptions} from './source/extends-strict.d.ts';
|
|
208
221
|
export type {ExtractStrict} from './source/extract-strict.d.ts';
|
|
209
222
|
export type {ExcludeStrict} from './source/exclude-strict.d.ts';
|
|
223
|
+
export type {ExcludeExactly} from './source/exclude-exactly.d.ts';
|
|
224
|
+
export type {ExtractExactly} from './source/extract-exactly.d.ts';
|
|
210
225
|
|
|
211
226
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/type-fest",
|
|
3
|
-
"version": "5.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.9.0-depup.0",
|
|
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",
|
|
7
7
|
"funding": "https://github.com/sponsors/sindresorhus",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"test:tsc": "node --max-old-space-size=6144 ./node_modules/.bin/tsc",
|
|
29
29
|
"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",
|
|
30
|
+
"test:xo": "node --max-old-space-size=6144 ./node_modules/.bin/xo --ignores=lint-processors/fixtures/**/*.d.ts '**/*.{js,ts,md}'",
|
|
31
31
|
"test:linter": "node --test",
|
|
32
32
|
"test": "run-p test:*"
|
|
33
33
|
},
|
|
@@ -35,13 +35,17 @@
|
|
|
35
35
|
"index.d.ts",
|
|
36
36
|
"source",
|
|
37
37
|
"license-mit",
|
|
38
|
-
"license-cc0"
|
|
38
|
+
"license-cc0",
|
|
39
|
+
"changes.json",
|
|
40
|
+
"README.md"
|
|
39
41
|
],
|
|
40
42
|
"keywords": [
|
|
41
|
-
"depup",
|
|
42
|
-
"dependency-bumped",
|
|
43
|
-
"updated-deps",
|
|
44
43
|
"type-fest",
|
|
44
|
+
"depup",
|
|
45
|
+
"updated-dependencies",
|
|
46
|
+
"security",
|
|
47
|
+
"latest",
|
|
48
|
+
"patched",
|
|
45
49
|
"typescript",
|
|
46
50
|
"ts",
|
|
47
51
|
"types",
|
|
@@ -57,17 +61,19 @@
|
|
|
57
61
|
"tagged-tag": "^1.0.0"
|
|
58
62
|
},
|
|
59
63
|
"devDependencies": {
|
|
64
|
+
"@eslint/markdown": "^8.0.1",
|
|
60
65
|
"@sindresorhus/tsconfig": "^8.0.1",
|
|
66
|
+
"@types/node": "^25.5.0",
|
|
61
67
|
"@typescript-eslint/parser": "^8.44.0",
|
|
62
|
-
"eslint": "^9.35.0",
|
|
63
68
|
"@typescript/vfs": "^1.6.1",
|
|
64
69
|
"dedent": "^1.7.0",
|
|
70
|
+
"eslint": "^10.1.0",
|
|
65
71
|
"expect-type": "^1.2.2",
|
|
66
72
|
"npm-run-all2": "^8.0.4",
|
|
67
73
|
"tsd": "^0.33.0",
|
|
68
74
|
"typescript": "^5.9.2",
|
|
69
75
|
"typescript-eslint": "^8.47.0",
|
|
70
|
-
"xo": "^
|
|
76
|
+
"xo": "^2.0.2"
|
|
71
77
|
},
|
|
72
78
|
"tsd": {
|
|
73
79
|
"compilerOptions": {
|
|
@@ -78,8 +84,8 @@
|
|
|
78
84
|
"changes": {},
|
|
79
85
|
"depsUpdated": 0,
|
|
80
86
|
"originalPackage": "type-fest",
|
|
81
|
-
"originalVersion": "5.
|
|
82
|
-
"processedAt": "2026-
|
|
87
|
+
"originalVersion": "5.9.0",
|
|
88
|
+
"processedAt": "2026-09-06T01:00:57.924Z",
|
|
83
89
|
"smokeTest": "failed"
|
|
84
90
|
}
|
|
85
91
|
}
|
package/readme.md
CHANGED
|
@@ -29,6 +29,17 @@
|
|
|
29
29
|
<sup>An open-source framework that supports any programming language, cloud provider, or deployment automation tool.</sup>
|
|
30
30
|
</div>
|
|
31
31
|
</a>
|
|
32
|
+
<br>
|
|
33
|
+
<br>
|
|
34
|
+
<a href="https://circleback.ai?utm_source=sindresorhus&utm_medium=sponsorship&utm_campaign=awesome-list&utm_id=type-fest">
|
|
35
|
+
<div>
|
|
36
|
+
<img width="300" src="https://sindresorhus.com/assets/thanks/circleback-logo.png?x" alt="Circleback logo">
|
|
37
|
+
</div>
|
|
38
|
+
<b>Get the most out of every conversation.</b>
|
|
39
|
+
<div>
|
|
40
|
+
<sup>AI-powered meeting notes, automations, and search. Give AI agents the context they need to get things done.</sup>
|
|
41
|
+
</div>
|
|
42
|
+
</a>
|
|
32
43
|
</p>
|
|
33
44
|
</div>
|
|
34
45
|
<br>
|
|
@@ -102,73 +113,76 @@ Click the type names for complete docs.
|
|
|
102
113
|
- [`UnknownArray`](source/unknown-array.d.ts) - Represents an array with `unknown` value.
|
|
103
114
|
- [`UnknownMap`](source/unknown-map.d.ts) - Represents a map with `unknown` key and value.
|
|
104
115
|
- [`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.
|
|
116
|
+
- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys.
|
|
106
117
|
- [`Writable`](source/writable.d.ts) - Create a type that strips `readonly` from the given type. Inverse of `Readonly<T>`.
|
|
107
118
|
- [`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
119
|
- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
|
109
120
|
- [`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
121
|
- [`MergeDeep`](source/merge-deep.d.ts) - Merge two objects or two arrays/tuples recursively into a new type.
|
|
111
122
|
- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.
|
|
112
|
-
- [`OverrideProperties`](source/override-properties.d.ts) - Override
|
|
113
|
-
- [`
|
|
114
|
-
- [`
|
|
115
|
-
- [`
|
|
116
|
-
- [`
|
|
123
|
+
- [`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.
|
|
124
|
+
- [`RenameKeys`](source/rename-keys.d.ts) - Rename keys in an object type according to a map of old-to-new names.
|
|
125
|
+
- [`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.
|
|
126
|
+
- [`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.
|
|
127
|
+
- [`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.
|
|
128
|
+
- [`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
129
|
- [`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.
|
|
119
|
-
- [`PickDeep`](source/pick-deep.d.ts) - Pick properties from a deeply-nested object.
|
|
120
|
-
- [`OmitDeep`](source/omit-deep.d.ts) - Omit properties from a deeply-nested object.
|
|
130
|
+
- [`RequiredDeep`](source/required-deep.d.ts) - Create a deeply required version of another type.
|
|
131
|
+
- [`PickDeep`](source/pick-deep.d.ts) - Pick properties from a deeply-nested object.
|
|
132
|
+
- [`OmitDeep`](source/omit-deep.d.ts) - Omit properties from a deeply-nested object.
|
|
121
133
|
- [`OmitIndexSignature`](source/omit-index-signature.d.ts) - Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
122
134
|
- [`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.
|
|
135
|
+
- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type.
|
|
124
136
|
- [`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
137
|
- [`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
138
|
- [`UnwrapPartial`](source/unwrap-partial.d.ts) - Revert the `Partial` modifier on an object type.
|
|
127
|
-
- [`
|
|
128
|
-
- [`
|
|
129
|
-
- [`
|
|
130
|
-
- [`
|
|
139
|
+
- [`UnwrapRequired`](source/unwrap-required.d.ts) - Revert the `Required` modifier on an object type.
|
|
140
|
+
- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of another type.
|
|
141
|
+
- [`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.
|
|
142
|
+
- [`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).
|
|
143
|
+
- [`UnwrapTagged`](source/tagged.d.ts) - Get the untagged portion of a tagged type created with `Tagged`.
|
|
131
144
|
- [`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) -
|
|
136
|
-
- [`SetNonNullable`](source/set-non-nullable.d.ts) - Create a type that makes the given keys non-nullable.
|
|
145
|
+
- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional, while keeping the remaining keys as is.
|
|
146
|
+
- [`SetReadonly`](source/set-readonly.d.ts) - Create a type that makes the given keys readonly, while keeping the remaining keys as is.
|
|
147
|
+
- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required, while keeping the remaining keys as is.
|
|
148
|
+
- [`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.
|
|
149
|
+
- [`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
150
|
- [`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.
|
|
151
|
+
- [`NonNullableDeep`](source/non-nullable-deep.d.ts) - Recursively removes `null` and `undefined` from the specified type.
|
|
138
152
|
- [`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
|
|
140
|
-
- [`ConditionalPick`](source/conditional-pick.d.ts) -
|
|
141
|
-
- [`ConditionalPickDeep`](source/conditional-pick-deep.d.ts) -
|
|
142
|
-
- [`ConditionalExcept`](source/conditional-except.d.ts) -
|
|
153
|
+
- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract the keys from a type where the value type of the key extends the given `Condition`.
|
|
154
|
+
- [`ConditionalPick`](source/conditional-pick.d.ts) - Pick keys from the shape that matches the given `Condition`.
|
|
155
|
+
- [`ConditionalPickDeep`](source/conditional-pick-deep.d.ts) - Pick keys recursively from the shape that matches the given condition.
|
|
156
|
+
- [`ConditionalExcept`](source/conditional-except.d.ts) - Exclude keys from a shape that matches the given `Condition`.
|
|
143
157
|
- [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.
|
|
144
|
-
- [`LiteralToPrimitive`](source/literal-to-primitive.d.ts) -
|
|
158
|
+
- [`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
159
|
- [`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts) - Like `LiteralToPrimitive` except it converts literal types inside an object or array deeply.
|
|
146
160
|
- [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.
|
|
147
161
|
- [`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
|
|
149
|
-
- [`Entries`](source/entries.d.ts) - Create a type that
|
|
162
|
+
- [`Entry`](source/entry.d.ts) - Create a type that describes a single key-value pair produced when calling a collection’s `entries` method.
|
|
163
|
+
- [`Entries`](source/entries.d.ts) - Create a type that describes the key-value pairs produced when calling a collection’s `entries` method.
|
|
150
164
|
- [`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
165
|
- [`SetParameterType`](source/set-parameter-type.d.ts) - Create a function that replaces some parameters with the given parameters.
|
|
152
166
|
- [`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
167
|
- [`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
|
|
168
|
+
- [`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
169
|
- [`KeyAsString`](source/key-as-string.d.ts) - Get keys of the given type as strings.
|
|
156
170
|
- [`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.
|
|
171
|
+
- [`Exact`](source/exact.d.ts) - Create a type that does not allow extra properties, meaning it only allows properties that are explicitly declared.
|
|
158
172
|
- [`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
173
|
- [`OptionalKeysOf`](source/optional-keys-of.d.ts) - Extract all optional keys from the given type.
|
|
160
|
-
- [`HasOptionalKeys`](source/has-optional-keys.d.ts) -
|
|
174
|
+
- [`HasOptionalKeys`](source/has-optional-keys.d.ts) - Returns a boolean for whether the given type has any optional fields.
|
|
161
175
|
- [`RequiredKeysOf`](source/required-keys-of.d.ts) - Extract all required keys from the given type.
|
|
162
|
-
- [`HasRequiredKeys`](source/has-required-keys.d.ts) -
|
|
176
|
+
- [`HasRequiredKeys`](source/has-required-keys.d.ts) - Returns a boolean for whether the given type has any required fields.
|
|
163
177
|
- [`ReadonlyKeysOf`](source/readonly-keys-of.d.ts) - Extract all readonly keys from the given type.
|
|
164
|
-
- [`HasReadonlyKeys`](source/has-readonly-keys.d.ts) -
|
|
165
|
-
- [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all writable
|
|
166
|
-
- [`HasWritableKeys`](source/has-writable-keys.d.ts) -
|
|
178
|
+
- [`HasReadonlyKeys`](source/has-readonly-keys.d.ts) - Returns a boolean for whether the given type has any readonly fields.
|
|
179
|
+
- [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all writable keys from the given type.
|
|
180
|
+
- [`HasWritableKeys`](source/has-writable-keys.d.ts) - Returns a boolean for whether the given type has any writable fields.
|
|
167
181
|
- [`Spread`](source/spread.d.ts) - Mimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax.
|
|
168
182
|
- [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal.
|
|
169
183
|
- [`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
|
|
171
|
-
- [`IntClosedRange`](source/int-closed-range.d.ts) - Generate a union of numbers
|
|
184
|
+
- [`IntRange`](source/int-range.d.ts) - Generate a union of numbers between a specified start (inclusive) and end (exclusive), with an optional step.
|
|
185
|
+
- [`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
186
|
- [`ArrayIndices`](source/array-indices.d.ts) - Provides valid indices for a constant array or tuple.
|
|
173
187
|
- [`ArrayValues`](source/array-values.d.ts) - Provides all values for a constant array or tuple.
|
|
174
188
|
- [`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,11 +193,14 @@ Click the type names for complete docs.
|
|
|
179
193
|
- [`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
194
|
- [`AllUnionFields`](source/all-union-fields.d.ts) - Create a type with all fields from a union of object types.
|
|
181
195
|
- [`DistributedOmit`](source/distributed-omit.d.ts) - Omits keys from a type, distributing the operation over a union.
|
|
182
|
-
- [`DistributedPick`](source/distributed-pick.d.ts) -
|
|
183
|
-
- [`And`](source/and.d.ts) - Returns a boolean for whether two given types are both true
|
|
184
|
-
- [`Or`](source/or.d.ts) - Returns a boolean for whether either of two given types is true
|
|
185
|
-
- [`Xor`](source/xor.d.ts) - Returns a boolean for whether only one of two given types is true
|
|
196
|
+
- [`DistributedPick`](source/distributed-pick.d.ts) - Pick keys from a type, distributing the operation over a union.
|
|
197
|
+
- [`And`](source/and.d.ts) - Returns a boolean for whether two given types are both `true`.
|
|
198
|
+
- [`Or`](source/or.d.ts) - Returns a boolean for whether either of two given types is `true`.
|
|
199
|
+
- [`Xor`](source/xor.d.ts) - Returns a boolean for whether only one of two given types is `true`.
|
|
200
|
+
- [`AndAll`](source/and-all.d.ts) - Returns a boolean for whether all of the given elements are `true`.
|
|
201
|
+
- [`OrAll`](source/or-all.d.ts) - Returns a boolean for whether any of the given elements is `true`.
|
|
186
202
|
- [`AllExtend`](source/all-extend.d.ts) - Returns a boolean for whether every element in an array type extends another type.
|
|
203
|
+
- [`SomeExtend`](source/some-extend.d.ts) - Returns a boolean for whether some element in an array type extends another type.
|
|
187
204
|
- [`NonEmptyTuple`](source/non-empty-tuple.d.ts) - Matches any non-empty tuple.
|
|
188
205
|
- [`NonEmptyString`](source/non-empty-string.d.ts) - Matches any non-empty string.
|
|
189
206
|
- [`FindGlobalType`](source/find-global-type.d.ts) - Tries to find the type of a global with the given name.
|
|
@@ -191,15 +208,18 @@ Click the type names for complete docs.
|
|
|
191
208
|
- [`ConditionalSimplify`](source/conditional-simplify.d.ts) - Simplifies a type while including and/or excluding certain types from being simplified.
|
|
192
209
|
- [`ConditionalSimplifyDeep`](source/conditional-simplify-deep.d.ts) - Recursively simplifies a type while including and/or excluding certain types from being simplified.
|
|
193
210
|
- [`ExclusifyUnion`](source/exclusify-union.d.ts) - Ensure mutual exclusivity in object unions by adding other members’ keys as `?: never`.
|
|
211
|
+
- [`Optional`](source/optional.d.ts) - Create a type that represents either the value or `undefined`, while stripping `null` from the type.
|
|
212
|
+
- [`UnionMember`](source/union-member.d.ts) - Returns an arbitrary member of a union type.
|
|
213
|
+
- [`UnionLength`](source/union-length.d.ts) - Returns the length of a union type.
|
|
194
214
|
|
|
195
215
|
### Type Guard
|
|
196
216
|
|
|
197
217
|
- [`If`](source/if.d.ts) - An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
198
218
|
- [`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).
|
|
199
|
-
- [`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).
|
|
200
|
-
- [`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).
|
|
201
|
-
- [`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).
|
|
202
|
-
- [`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).
|
|
219
|
+
- [`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).
|
|
220
|
+
- [`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).
|
|
221
|
+
- [`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).
|
|
222
|
+
- [`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).
|
|
203
223
|
- [`IsAny`](source/is-any.d.ts) - Returns a boolean for whether the given type is `any`.
|
|
204
224
|
- [`IsNever`](source/is-never.d.ts) - Returns a boolean for whether the given type is `never`.
|
|
205
225
|
- [`IsUnknown`](source/is-unknown.d.ts) - Returns a boolean for whether the given type is `unknown`.
|
|
@@ -221,7 +241,7 @@ Click the type names for complete docs.
|
|
|
221
241
|
|
|
222
242
|
- [`Jsonify`](source/jsonify.d.ts) - Transform a type to one that is assignable to the `JsonValue` type.
|
|
223
243
|
- [`Jsonifiable`](source/jsonifiable.d.ts) - Matches a value that can be losslessly converted to JSON.
|
|
224
|
-
- [`JsonPrimitive`](source/json-value.d.ts) - Matches
|
|
244
|
+
- [`JsonPrimitive`](source/json-value.d.ts) - Matches any valid JSON primitive value.
|
|
225
245
|
- [`JsonObject`](source/json-value.d.ts) - Matches a JSON object.
|
|
226
246
|
- [`JsonArray`](source/json-value.d.ts) - Matches a JSON array.
|
|
227
247
|
- [`JsonValue`](source/json-value.d.ts) - Matches any valid JSON value.
|
|
@@ -234,17 +254,20 @@ Click the type names for complete docs.
|
|
|
234
254
|
|
|
235
255
|
- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
|
236
256
|
- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
|
|
237
|
-
- [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.
|
|
257
|
+
- [`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.
|
|
238
258
|
|
|
239
259
|
### String
|
|
240
260
|
|
|
241
261
|
- [`Trim`](source/trim.d.ts) - Remove leading and trailing spaces from a string.
|
|
242
262
|
- [`Split`](source/split.d.ts) - Represents an array of strings split using a given character or character set.
|
|
243
|
-
- [`Words`](source/words.d.ts) -
|
|
263
|
+
- [`Words`](source/words.d.ts) - Split a string similar to Lodash's `_.words()` function.
|
|
244
264
|
- [`Replace`](source/replace.d.ts) - Represents a string with some or all matches replaced by a replacement.
|
|
245
265
|
- [`StringSlice`](source/string-slice.d.ts) - Returns a string slice of a given range, just like `String#slice()`.
|
|
246
266
|
- [`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()`.
|
|
247
267
|
- [`RemovePrefix`](source/remove-prefix.d.ts) - Remove the specified prefix from the start of a string.
|
|
268
|
+
- [`RemoveSuffix`](source/remove-suffix.d.ts) - Remove the specified suffix from the end of a string.
|
|
269
|
+
- [`StringToArray`](source/string-to-array.d.ts) - Returns an array of the characters of the specified string.
|
|
270
|
+
- [`StringLength`](source/string-length.d.ts) - Returns the length of the given string.
|
|
248
271
|
|
|
249
272
|
### Array
|
|
250
273
|
|
|
@@ -255,8 +278,8 @@ Click the type names for complete docs.
|
|
|
255
278
|
- [`ArrayElement`](source/array-element.d.ts) - Extracts the element type of an array or tuple.
|
|
256
279
|
- [`LastArrayElement`](source/last-array-element.d.ts) - Extract the type of the last element of an array.
|
|
257
280
|
- [`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.
|
|
258
|
-
- [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and
|
|
259
|
-
- [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and
|
|
281
|
+
- [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimension.
|
|
282
|
+
- [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimension.
|
|
260
283
|
- [`ReadonlyTuple`](source/readonly-tuple.d.ts) - Create a type that represents a read-only tuple of the given type and length.
|
|
261
284
|
- [`TupleToUnion`](source/tuple-to-union.d.ts) - Convert a tuple/array into a union type of its elements.
|
|
262
285
|
- [`UnionToTuple`](source/union-to-tuple.d.ts) - Convert a union type into an unordered tuple type of its elements.
|
|
@@ -266,6 +289,7 @@ Click the type names for complete docs.
|
|
|
266
289
|
- [`ExtractRestElement`](source/extract-rest-element.d.ts) - Extract the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element type from an array.
|
|
267
290
|
- [`ExcludeRestElement`](source/exclude-rest-element.d.ts) - Create a tuple with the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element removed.
|
|
268
291
|
- [`ArrayReverse`](source/array-reverse.d.ts) - Reverse the order of elements in a tuple type.
|
|
292
|
+
- [`ArrayLength`](source/array-length.d.ts) - Return the length of an array. Equivalent to `T['length']` where `T` extends any array.
|
|
269
293
|
|
|
270
294
|
### Numeric
|
|
271
295
|
|
|
@@ -281,29 +305,31 @@ Click the type names for complete docs.
|
|
|
281
305
|
- [`NonNegativeInteger`](source/numeric.d.ts) - A non-negative (`0 <= x < ∞`) `number` that is an integer.
|
|
282
306
|
- [`IsNegative`](source/numeric.d.ts) - Returns a boolean for whether the given number is a negative number.
|
|
283
307
|
- [`IsFloat`](source/is-float.d.ts) - Returns a boolean for whether the given number is a float, like `1.5` or `-1.5`.
|
|
284
|
-
- [`IsInteger`](source/is-integer.d.ts) - Returns a boolean for whether the given number is
|
|
308
|
+
- [`IsInteger`](source/is-integer.d.ts) - Returns a boolean for whether the given number is an integer, like `-5`, `1.0`, or `100`.
|
|
285
309
|
- [`GreaterThan`](source/greater-than.d.ts) - Returns a boolean for whether a given number is greater than another number.
|
|
286
310
|
- [`GreaterThanOrEqual`](source/greater-than-or-equal.d.ts) - Returns a boolean for whether a given number is greater than or equal to another number.
|
|
287
311
|
- [`LessThan`](source/less-than.d.ts) - Returns a boolean for whether a given number is less than another number.
|
|
288
312
|
- [`LessThanOrEqual`](source/less-than-or-equal.d.ts) - Returns a boolean for whether a given number is less than or equal to another number.
|
|
289
313
|
- [`Sum`](source/sum.d.ts) - Returns the sum of two numbers.
|
|
290
314
|
- [`Subtract`](source/subtract.d.ts) - Returns the difference between two numbers.
|
|
315
|
+
- [`Absolute`](source/absolute.d.ts) - Returns the absolute value of the specified number or bigint.
|
|
316
|
+
- [`StringToNumber`](source/string-to-number.d.ts) - Converts a numeric string to a number.
|
|
291
317
|
|
|
292
318
|
### Change case
|
|
293
319
|
|
|
294
|
-
- [`CamelCase`](source/camel-case.d.ts) - Convert a string literal to camel-case
|
|
295
|
-
- [`CamelCasedProperties`](source/camel-cased-properties.d.ts) - Convert object properties to camel
|
|
296
|
-
- [`CamelCasedPropertiesDeep`](source/camel-cased-properties-deep.d.ts) - Convert object properties to camel
|
|
297
|
-
- [`KebabCase`](source/kebab-case.d.ts) - Convert a string literal to kebab-case
|
|
298
|
-
- [`KebabCasedProperties`](source/kebab-cased-properties.d.ts) - Convert object properties to kebab
|
|
299
|
-
- [`KebabCasedPropertiesDeep`](source/kebab-cased-properties-deep.d.ts) - Convert object properties to kebab
|
|
300
|
-
- [`PascalCase`](source/pascal-case.d.ts) - Convert a string literal to pascal-case
|
|
301
|
-
- [`PascalCasedProperties`](source/pascal-cased-properties.d.ts) - Convert object properties to pascal
|
|
302
|
-
- [`PascalCasedPropertiesDeep`](source/pascal-cased-properties-deep.d.ts) - Convert object properties to pascal
|
|
303
|
-
- [`SnakeCase`](source/snake-case.d.ts) - Convert a string literal to snake-case
|
|
304
|
-
- [`SnakeCasedProperties`](source/snake-cased-properties.d.ts) - Convert object properties to snake
|
|
305
|
-
- [`SnakeCasedPropertiesDeep`](source/snake-cased-properties-deep.d.ts) - Convert object properties to snake
|
|
306
|
-
- [`ScreamingSnakeCase`](source/screaming-snake-case.d.ts) - Convert a string literal to screaming-snake-case
|
|
320
|
+
- [`CamelCase`](source/camel-case.d.ts) - Convert a string literal to camel-case.
|
|
321
|
+
- [`CamelCasedProperties`](source/camel-cased-properties.d.ts) - Convert top-level object properties to camel case.
|
|
322
|
+
- [`CamelCasedPropertiesDeep`](source/camel-cased-properties-deep.d.ts) - Convert object properties to camel case recursively.
|
|
323
|
+
- [`KebabCase`](source/kebab-case.d.ts) - Convert a string literal to kebab-case.
|
|
324
|
+
- [`KebabCasedProperties`](source/kebab-cased-properties.d.ts) - Convert top-level object properties to kebab case.
|
|
325
|
+
- [`KebabCasedPropertiesDeep`](source/kebab-cased-properties-deep.d.ts) - Convert object properties to kebab case recursively.
|
|
326
|
+
- [`PascalCase`](source/pascal-case.d.ts) - Convert a string literal to pascal-case.
|
|
327
|
+
- [`PascalCasedProperties`](source/pascal-cased-properties.d.ts) - Convert top-level object properties to pascal case.
|
|
328
|
+
- [`PascalCasedPropertiesDeep`](source/pascal-cased-properties-deep.d.ts) - Convert object properties to pascal case recursively.
|
|
329
|
+
- [`SnakeCase`](source/snake-case.d.ts) - Convert a string literal to snake-case.
|
|
330
|
+
- [`SnakeCasedProperties`](source/snake-cased-properties.d.ts) - Convert top-level object properties to snake case.
|
|
331
|
+
- [`SnakeCasedPropertiesDeep`](source/snake-cased-properties-deep.d.ts) - Convert object properties to snake case recursively.
|
|
332
|
+
- [`ScreamingSnakeCase`](source/screaming-snake-case.d.ts) - Convert a string literal to screaming-snake-case.
|
|
307
333
|
- [`DelimiterCase`](source/delimiter-case.d.ts) - Convert a string literal to a custom string delimiter casing.
|
|
308
334
|
- [`DelimiterCasedProperties`](source/delimiter-cased-properties.d.ts) - Convert object properties to a custom string delimiter casing.
|
|
309
335
|
- [`DelimiterCasedPropertiesDeep`](source/delimiter-cased-properties-deep.d.ts) - Convert object properties to a custom string delimiter casing recursively.
|
|
@@ -311,14 +337,16 @@ Click the type names for complete docs.
|
|
|
311
337
|
### Miscellaneous
|
|
312
338
|
|
|
313
339
|
- [`GlobalThis`](source/global-this.d.ts) - Declare locally scoped properties on `globalThis`.
|
|
314
|
-
- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file).
|
|
340
|
+
- [`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.
|
|
315
341
|
- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html).
|
|
316
342
|
|
|
317
343
|
### Improved built-in
|
|
318
344
|
|
|
319
|
-
- [`ExtendsStrict`](source/extends-strict.d.ts) - A
|
|
345
|
+
- [`ExtendsStrict`](source/extends-strict.d.ts) - A customizable version of `extends` for checking whether one type is assignable to another.
|
|
320
346
|
- [`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`.
|
|
321
347
|
- [`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`.
|
|
348
|
+
- [`ExcludeExactly`](source/exclude-exactly.d.ts) - A stricter version of `Exclude<T, U>` that excludes types only when they are exactly identical.
|
|
349
|
+
- [`ExtractExactly`](source/extract-exactly.d.ts) - A stricter version of `Extract<T, U>` that extracts types only when they are exactly identical.
|
|
322
350
|
|
|
323
351
|
## Declined types
|
|
324
352
|
|
|
@@ -353,13 +381,17 @@ Click the type names for complete docs.
|
|
|
353
381
|
- `PickByTypes` - See [`ConditionalPick`](source/conditional-pick.d.ts)
|
|
354
382
|
- `HomomorphicOmit` - See [`Except`](source/except.d.ts)
|
|
355
383
|
- `IfAny`, `IfNever`, `If*` - See [`If`](source/if.d.ts)
|
|
384
|
+
- `Maybe`, `Option` - See [`Optional`](source/optional.d.ts)
|
|
356
385
|
- `MaybePromise` - See [`Promisable`](source/promisable.d.ts)
|
|
357
386
|
- `ReadonlyTuple` - See [`TupleOf`](source/tuple-of.d.ts)
|
|
387
|
+
- `LastOfUnion` - See [`UnionMember`](source/union-member.d.ts)
|
|
388
|
+
- `FirstOfUnion` - See [`UnionMember`](source/union-member.d.ts)
|
|
358
389
|
|
|
359
390
|
## Tips
|
|
360
391
|
|
|
361
392
|
### Extending existing types
|
|
362
393
|
|
|
394
|
+
<!-- eslint-disable-next-line type-fest/readme-jsdoc-sync -->
|
|
363
395
|
- [`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.
|
|
364
396
|
<details>
|
|
365
397
|
<summary>
|
|
@@ -509,6 +541,8 @@ There are many advanced types most users don't know about.
|
|
|
509
541
|
email: 'ex@mple.com',
|
|
510
542
|
});
|
|
511
543
|
```
|
|
544
|
+
|
|
545
|
+
`Required<T>` can be reverted with [`UnwrapRequired`](source/unwrap-required.d.ts).
|
|
512
546
|
</details>
|
|
513
547
|
|
|
514
548
|
- [`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 {};
|
package/source/all-extend.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {If} from './if.d.ts';
|
|
2
1
|
import type {CollapseRestElement} from './internal/array.d.ts';
|
|
3
2
|
import type {ApplyDefaultOptions} from './internal/object.d.ts';
|
|
4
3
|
import type {IfNotAnyOrNever, Not} from './internal/type.d.ts';
|
|
@@ -104,17 +103,19 @@ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
|
|
|
104
103
|
export type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> =
|
|
105
104
|
_AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
|
|
106
105
|
|
|
107
|
-
type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray,
|
|
108
|
-
TArray extends readonly [infer First, ...infer Rest]
|
|
106
|
+
type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, {
|
|
107
|
+
ifNot: TArray extends readonly [infer First, ...infer Rest]
|
|
109
108
|
? IsNever<First> extends true
|
|
110
|
-
? Or<IsNever<Type>, Not<Options['strictNever']>> extends true
|
|
111
|
-
// If target `Type` is also `never`
|
|
109
|
+
? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true
|
|
110
|
+
// If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
|
|
112
111
|
? _AllExtend<Rest, Type, Options>
|
|
113
112
|
: false
|
|
114
113
|
: First extends Type
|
|
115
114
|
? _AllExtend<Rest, Type, Options>
|
|
116
115
|
: false
|
|
117
|
-
: true
|
|
118
|
-
|
|
116
|
+
: true;
|
|
117
|
+
ifAny: false;
|
|
118
|
+
ifNever: false;
|
|
119
|
+
}>;
|
|
119
120
|
|
|
120
121
|
export {};
|