Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/js-lib/src/typeFest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,21 @@ export type ConditionalExcept<Base, Condition> = Except<Base, ConditionalKeys<Ba
*/
export type ConditionalPick<Base, Condition> = Pick<Base, ConditionalKeys<Base, Condition>>

/**
Makes one property of T required instead of optional.
@example
```
import {RequireProp} from 'type-fest';
interface Example {
a?: string
b?: string
};
type ExampleA = RequireProp<Example, 'a'>;
//=> {a: string; b?: string};
```
*/
export type RequireProp<T, K extends keyof T> = Required<Pick<T, K>> & T

/**
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
*/
Expand Down