type-fest 3.11.0 → 3.11.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-fest",
3
- "version": "3.11.0",
3
+ "version": "3.11.1",
4
4
  "description": "A collection of essential TypeScript types",
5
5
  "license": "(MIT OR CC0-1.0)",
6
6
  "repository": "sindresorhus/type-fest",
@@ -208,26 +208,12 @@ declare namespace PackageJson {
208
208
  */
209
209
  export type Dependency = Partial<Record<string, string>>;
210
210
 
211
- /**
212
- Conditions which provide a way to resolve a package entry point based on the environment.
213
- */
214
- export type ExportCondition = LiteralUnion<
215
- | 'import'
216
- | 'require'
217
- | 'node'
218
- | 'node-addons'
219
- | 'deno'
220
- | 'browser'
221
- | 'electron'
222
- | 'react-native'
223
- | 'default',
224
- string
225
- >;
226
-
227
211
  /**
228
212
  A mapping of conditions and the paths to which they resolve.
229
213
  */
230
- type ExportConditions = {[condition in ExportCondition]?: Exports};
214
+ type ExportConditions = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
215
+ [condition: string]: Exports;
216
+ };
231
217
 
232
218
  /**
233
219
  Entry points of a module, optionally with conditions and subpath exports.
@@ -27,8 +27,14 @@ type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
27
27
  @category Object
28
28
  */
29
29
  export type SetRequired<BaseType, Keys extends keyof BaseType> =
30
- Simplify<
31
- BaseType &
32
- // Pick the keys that should be required from the base type and make them required.
33
- Required<Pick<BaseType, Keys>>
34
- >;
30
+ // `extends unknown` is always going to be the case and is used to convert any
31
+ // union into a [distributive conditional
32
+ // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
33
+ BaseType extends unknown
34
+ ? Simplify<
35
+ // Pick just the keys that are optional from the base type.
36
+ Except<BaseType, Keys> &
37
+ // Pick the keys that should be required from the base type and make them required.
38
+ Required<Pick<BaseType, Keys>>
39
+ >
40
+ : never;