type-fest 4.18.2 → 4.18.3

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": "4.18.2",
3
+ "version": "4.18.3",
4
4
  "description": "A collection of essential TypeScript types",
5
5
  "license": "(MIT OR CC0-1.0)",
6
6
  "repository": "sindresorhus/type-fest",
@@ -1,3 +1,5 @@
1
+ import type {IfNever} from './if-never';
2
+
1
3
  /**
2
4
  Extract the keys from a type where the value type of the key extends the given `Condition`.
3
5
 
@@ -36,10 +38,10 @@ export type ConditionalKeys<Base, Condition> =
36
38
  [Key in keyof Base]-?:
37
39
  // Pick only keys with types extending the given `Condition` type.
38
40
  Base[Key] extends Condition
39
- // Retain this key since the condition passes.
40
- ? Key
41
+ // Retain this key
42
+ // If the value for the key extends never, only include it if `Condition` also extends never
43
+ ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
41
44
  // Discard this key since the condition fails.
42
45
  : never;
43
-
44
46
  // Convert the produced object into a union type of the keys which passed the conditional test.
45
47
  }[keyof Base];