12 lines
314 B
TypeScript
12 lines
314 B
TypeScript
|
|
/**
|
||
|
|
* Utility type to remove null from a type
|
||
|
|
*/
|
||
|
|
export type RemoveNull<T> = T extends null ? never : T;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Utility type to remove null from all properties of an object type
|
||
|
|
*/
|
||
|
|
export type RemoveNullFromObject<T, K extends keyof T = keyof T> = {
|
||
|
|
[L in keyof T]: L extends K ? RemoveNull<T[L]> : T[L];
|
||
|
|
};
|