Skip to content

Commit 9f4a996

Browse files
committed
feat(types): Add utility types
Signed-off-by: Drew Hoener <[email protected]>
1 parent 724574e commit 9f4a996

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/types/interface-types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Represents a type that can either be a value of type `T` or `undefined`.
3+
*/
4+
export type Optional<T> = T | undefined;
5+
6+
/**
7+
* Represents a type that can either be a value of type `T` or `null`.
8+
*/
9+
export type Nullable<T> = T | null;
10+
11+
/**
12+
* Represents an object type where all properties are optional, and included properties can be null or undefined.
13+
*/
14+
export type PartialNullable<T> = {
15+
[P in keyof T]?: Nullable<T[P]>;
16+
};

0 commit comments

Comments
 (0)