-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object.Partial deep and array object values #288
Comments
Solution to exclude array which works in our case, might be useful for someone: type ObjectFieldsOptional<T> = {
[P in keyof T]?: T[P] extends Array<any>
? T[P]
: T[P] extends object
? ObjectFieldsOptional<T[P]>
: T[P]
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
馃悶 Bug Report
Describe the bug
Object.Partial with deep flag changes the value of a key if it is an array by mapping array of type Type[] to (Type | undefined)[] | undefined, so it changes type type of an array.
Is it intentional or a bug? And if it is intentional, then how to avoid mapping values of the array.
Reproduce the bug
Expected behavior
foo?: (string | undefined)[] | undefined
should befoo?: string[] | undefined
Possible Solution
Not sure if it was intentional
Screenshots
Additional context
The text was updated successfully, but these errors were encountered: