Skip to content

Commit

Permalink
feat(type-helper): add StrictlyRequired type
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd committed Sep 29, 2024
1 parent c9e6970 commit 6d2831e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/type-helper/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ export type ArrayItems<T> = T extends (infer K)[] ? K : T;
*/
export type Merge<M, N> = Omit<M, keyof N> & N;

/**
* Make all properties in T required and exclude undefined and null from the property type.
*/
export type StrictlyRequired<T> = {
[P in keyof T]-?: NonNullable<T[P]>;
};

/**
* Represents an object that has the ability to add event listeners.
*/
Expand Down

0 comments on commit 6d2831e

Please sign in to comment.