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 +1 -1
- package/source/package-json.d.ts +3 -17
- package/source/set-required.d.ts +11 -5
package/package.json
CHANGED
package/source/package-json.d.ts
CHANGED
|
@@ -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 = {
|
|
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.
|
package/source/set-required.d.ts
CHANGED
|
@@ -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
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
|
|
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;
|