type-fest 3.7.1 → 3.7.2
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 +1 -1
- package/readme.md +1 -0
- package/source/merge.d.ts +3 -7
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -270,6 +270,7 @@ Click the type names for complete docs.
|
|
|
270
270
|
- `PartialBy` - See [`SetOptional`](https://github.com/sindresorhus/type-fest/blob/main/source/set-optional.d.ts)
|
|
271
271
|
- `RecordDeep`- See [`Schema`](https://github.com/sindresorhus/type-fest/blob/main/source/schema.d.ts)
|
|
272
272
|
- `Mutable`- See [`Writable`](https://github.com/sindresorhus/type-fest/blob/main/source/writable.d.ts)
|
|
273
|
+
- `Prettify`- See [`Simplify`](https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts)
|
|
273
274
|
|
|
274
275
|
## Tips
|
|
275
276
|
|
package/source/merge.d.ts
CHANGED
|
@@ -2,14 +2,10 @@ import type {OmitIndexSignature} from './omit-index-signature';
|
|
|
2
2
|
import type {PickIndexSignature} from './pick-index-signature';
|
|
3
3
|
import type {EnforceOptional} from './enforce-optional';
|
|
4
4
|
|
|
5
|
-
// Merges two objects without worrying about index signatures
|
|
5
|
+
// Merges two objects without worrying about index signatures.
|
|
6
6
|
type SimpleMerge<Destination, Source> = {
|
|
7
|
-
[Key in keyof Destination
|
|
8
|
-
|
|
9
|
-
: Key extends keyof Destination
|
|
10
|
-
? Destination[Key]
|
|
11
|
-
: never;
|
|
12
|
-
};
|
|
7
|
+
[Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
|
|
8
|
+
} & Source;
|
|
13
9
|
|
|
14
10
|
/**
|
|
15
11
|
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|