type-fest 3.9.0 → 3.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-fest",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "description": "A collection of essential TypeScript types",
5
5
  "license": "(MIT OR CC0-1.0)",
6
6
  "repository": "sindresorhus/type-fest",
@@ -40,6 +40,9 @@
40
40
  "typescript": "^5.0.2",
41
41
  "xo": "^0.53.1"
42
42
  },
43
+ "peerDependencies": {
44
+ "typescript": ">=4.7.0"
45
+ },
43
46
  "xo": {
44
47
  "rules": {
45
48
  "@typescript-eslint/ban-ts-comment": "off",
package/readme.md CHANGED
@@ -37,37 +37,6 @@
37
37
  <sup>Add Single Sign-On (and more) in minutes instead of months.</sup>
38
38
  </div>
39
39
  </a>
40
- <br>
41
- <br>
42
- <br>
43
- <a href="https://www.useanvil.com/?utm_source=sindresorhus#gh-light-mode-only">
44
- <div>
45
- <img src="https://sindresorhus.com/assets/thanks/anvil-logo-light.svg" width="200" alt="Anvil">
46
- </div>
47
- <br>
48
- <b>Paperwork that makes the data work.</b>
49
- <div>
50
- <sub>
51
- Easy APIs for paperwork. PDF generation, e-signature and embeddable no-code webforms.
52
- <br>
53
- The easiest way to build paperwork automation into your product.
54
- </sub>
55
- </div>
56
- </a>
57
- <a href="https://www.useanvil.com/?utm_source=sindresorhus#gh-dark-mode-only">
58
- <div>
59
- <img src="https://sindresorhus.com/assets/thanks/anvil-logo-dark.svg" width="200" alt="Anvil">
60
- </div>
61
- <br>
62
- <b>Paperwork that makes the data work.</b>
63
- <div>
64
- <sub>
65
- Easy APIs for paperwork. PDF generation, e-signature and embeddable no-code webforms.
66
- <br>
67
- The easiest way to build paperwork automation into your product.
68
- </sub>
69
- </div>
70
- </a>
71
40
  </p>
72
41
  </div>
73
42
  <br>
@@ -15,12 +15,15 @@ type Bar = OverrideProperties<Foo, {b: number}>
15
15
  //=> {a: string, b: number}
16
16
 
17
17
  type Baz = OverrideProperties<Foo, {c: number}>
18
- // error TS2559: Type '{c: number}' has no properties in common with type 'Partial{a: unknown; b: unknown}>'.
18
+ // Error, type '{ c: number; }' does not satisfy the constraint '{ c: never; }'
19
+
20
+ type Fizz = OverrideProperties<Foo, {b: number; c: number}>
21
+ // Error, type '{ b: number; c: number; }' does not satisfy the constraint '{ b: number; c: never; }'
19
22
  ```
20
23
 
21
24
  @category Object
22
25
  */
23
26
  export type OverrideProperties<
24
27
  TOriginal,
25
- TOverride extends Partial<{[key in keyof TOriginal]: unknown}>,
28
+ TOverride extends {[Key in keyof TOverride]: Key extends keyof TOriginal ? TOverride[Key] : never},
26
29
  > = Merge<TOriginal, TOverride>;
@@ -28,8 +28,7 @@ type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
28
28
  */
29
29
  export type SetRequired<BaseType, Keys extends keyof BaseType> =
30
30
  Simplify<
31
- // Pick just the keys that are optional from the base type.
32
- Except<BaseType, Keys> &
31
+ BaseType &
33
32
  // Pick the keys that should be required from the base type and make them required.
34
33
  Required<Pick<BaseType, Keys>>
35
34
  >;