@naturalcycles/js-lib 15.53.0 → 15.54.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.
@@ -167,6 +167,20 @@ export type ConditionalExcept<Base, Condition> = Except<Base, ConditionalKeys<Ba
167
167
  ```
168
168
  */
169
169
  export type ConditionalPick<Base, Condition> = Pick<Base, ConditionalKeys<Base, Condition>>;
170
+ /**
171
+ Makes one property of T required instead of optional.
172
+ @example
173
+ ```
174
+ import {RequireProp} from 'type-fest';
175
+ interface Example {
176
+ a?: string
177
+ b?: string
178
+ };
179
+ type ExampleA = RequireProp<Example, 'a'>;
180
+ //=> {a: string; b?: string};
181
+ ```
182
+ */
183
+ export type RequireProp<T, K extends keyof T> = Required<Pick<T, K>> & T;
170
184
  /**
171
185
  Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
172
186
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
3
  "type": "module",
4
- "version": "15.53.0",
4
+ "version": "15.54.0",
5
5
  "dependencies": {
6
6
  "tslib": "^2",
7
7
  "undici": "^7",
package/src/typeFest.ts CHANGED
@@ -197,6 +197,21 @@ export type ConditionalExcept<Base, Condition> = Except<Base, ConditionalKeys<Ba
197
197
  */
198
198
  export type ConditionalPick<Base, Condition> = Pick<Base, ConditionalKeys<Base, Condition>>
199
199
 
200
+ /**
201
+ Makes one property of T required instead of optional.
202
+ @example
203
+ ```
204
+ import {RequireProp} from 'type-fest';
205
+ interface Example {
206
+ a?: string
207
+ b?: string
208
+ };
209
+ type ExampleA = RequireProp<Example, 'a'>;
210
+ //=> {a: string; b?: string};
211
+ ```
212
+ */
213
+ export type RequireProp<T, K extends keyof T> = Required<Pick<T, K>> & T
214
+
200
215
  /**
201
216
  Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
202
217
  */