@naturalcycles/js-lib 15.53.0 → 15.55.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/dist/typeFest.d.ts +3 -0
- package/dist/types.d.ts +15 -1
- package/dist/types.js +1 -0
- package/package.json +1 -1
- package/src/typeFest.ts +4 -0
- package/src/types.ts +17 -0
package/dist/typeFest.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -403,4 +403,18 @@ interface ReadonlySetDeep<ItemType> extends ReadonlySet<ReadonlyDeep<ItemType>>
|
|
|
403
403
|
type ReadonlyObjectDeep<ObjectType extends object> = {
|
|
404
404
|
readonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>;
|
|
405
405
|
};
|
|
406
|
-
|
|
406
|
+
/**
|
|
407
|
+
Makes one property of T required instead of optional.
|
|
408
|
+
@example
|
|
409
|
+
```
|
|
410
|
+
import { RequiredProp } from '@naturalcycles/js-lib/types'
|
|
411
|
+
interface Example {
|
|
412
|
+
a?: string
|
|
413
|
+
b?: string
|
|
414
|
+
};
|
|
415
|
+
type ExampleA = RequiredProp<Example, 'a'>;
|
|
416
|
+
//=> {a: string; b?: string};
|
|
417
|
+
```
|
|
418
|
+
*/
|
|
419
|
+
export type RequiredProp<T, K extends keyof T> = Required<Pick<T, K>> & T;
|
|
420
|
+
export * from './typeFest.js';
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
package/src/typeFest.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -509,4 +509,21 @@ type ReadonlyObjectDeep<ObjectType extends object> = {
|
|
|
509
509
|
readonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
+
/**
|
|
513
|
+
Makes one property of T required instead of optional.
|
|
514
|
+
@example
|
|
515
|
+
```
|
|
516
|
+
import { RequiredProp } from '@naturalcycles/js-lib/types'
|
|
517
|
+
interface Example {
|
|
518
|
+
a?: string
|
|
519
|
+
b?: string
|
|
520
|
+
};
|
|
521
|
+
type ExampleA = RequiredProp<Example, 'a'>;
|
|
522
|
+
//=> {a: string; b?: string};
|
|
523
|
+
```
|
|
524
|
+
*/
|
|
525
|
+
export type RequiredProp<T, K extends keyof T> = Required<Pick<T, K>> & T
|
|
526
|
+
|
|
512
527
|
/* eslint-enable */
|
|
528
|
+
|
|
529
|
+
export * from './typeFest.js'
|