type-fest 4.7.0 → 4.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/source/partial-deep.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {BuiltIns
|
|
1
|
+
import type {BuiltIns} from './internal';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
@see PartialDeep
|
|
@@ -69,9 +69,8 @@ export type PartialDeep<T, Options extends PartialDeepOptions = {}> = T extends
|
|
|
69
69
|
? PartialReadonlyMapDeep<KeyType, ValueType, Options>
|
|
70
70
|
: T extends ReadonlySet<infer ItemType>
|
|
71
71
|
? PartialReadonlySetDeep<ItemType, Options>
|
|
72
|
-
: T extends
|
|
73
|
-
?
|
|
74
|
-
: T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
72
|
+
: T extends object
|
|
73
|
+
? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
75
74
|
? Options['recurseIntoArrays'] extends true
|
|
76
75
|
? ItemType[] extends T // Test for arrays (non-tuples) specifically
|
|
77
76
|
? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
|
|
@@ -79,7 +78,8 @@ export type PartialDeep<T, Options extends PartialDeepOptions = {}> = T extends
|
|
|
79
78
|
: Array<PartialDeep<ItemType | undefined, Options>>
|
|
80
79
|
: PartialObjectDeep<T, Options> // Tuples behave properly
|
|
81
80
|
: T // If they don't opt into array testing, just use the original type
|
|
82
|
-
: T
|
|
81
|
+
: PartialObjectDeep<T, Options>
|
|
82
|
+
: unknown;
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
package/source/pick-deep.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ type Configuration = {
|
|
|
37
37
|
type NameConfig = PickDeep<Configuration, 'userConfig.name'>;
|
|
38
38
|
// type NameConfig = {
|
|
39
39
|
// userConfig: {
|
|
40
|
-
//
|
|
40
|
+
// name: string;
|
|
41
|
+
// }
|
|
41
42
|
// };
|
|
42
43
|
|
|
43
44
|
// Supports optional properties
|
|
@@ -50,7 +51,7 @@ type User = PickDeep<PartialDeep<Configuration>, 'userConfig.name' | 'userConfig
|
|
|
50
51
|
// };
|
|
51
52
|
|
|
52
53
|
// Supports array
|
|
53
|
-
type AddressConfig = PickDeep<Configuration,
|
|
54
|
+
type AddressConfig = PickDeep<Configuration, 'userConfig.address.0'>;
|
|
54
55
|
// type AddressConfig = {
|
|
55
56
|
// userConfig: {
|
|
56
57
|
// address: [{
|
|
@@ -61,8 +62,8 @@ type AddressConfig = PickDeep<Configuration, `userConfig.address.0`>;
|
|
|
61
62
|
// }
|
|
62
63
|
|
|
63
64
|
// Supports recurse into array
|
|
64
|
-
type Street = PickDeep<Configuration,
|
|
65
|
-
// type
|
|
65
|
+
type Street = PickDeep<Configuration, 'userConfig.address.1.street2'>;
|
|
66
|
+
// type Street = {
|
|
66
67
|
// userConfig: {
|
|
67
68
|
// address: [
|
|
68
69
|
// unknown,
|