Created
February 6, 2025 16:58
-
-
Save fmartins-andre/09e797168d458baa0d89f215dab8f712 to your computer and use it in GitHub Desktop.
Useful types to typescript projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare type StringfyKeys<T> = | |
T extends Record<string, unknown> ? `${keyof T}` : never | |
declare type NonNullableFields<T> = { | |
[P in keyof T]: NonNullable<T[P]> | |
} | |
declare type NonNullableField<T, K extends keyof T> = T & | |
NonNullableFields<Pick<T, K>> | |
declare type DeepNullable<T> = { | |
[K in keyof T]: DeepNullable<T[K]> | null | |
} | |
declare type DeepPartial<T> = { | |
[K in keyof T]?: DeepPartial<T[K]> | undefined | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment