-
-
Notifications
You must be signed in to change notification settings - Fork 567
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PartialDeep
: Add allowUndefinedInArrays
option
#1019
PartialDeep
: Add allowUndefinedInArrays
option
#1019
Conversation
Will this create confusion with tuples, because For eg, // @exactOptionalPropertyTypes: false
type Test = PartialDeep<
// ^? { a?: [string?] }
{a: [string]},
{recurseIntoArrays: true; allowUndefinedInArrays: false}
>;
const test: Test = {a: [undefined]}; In the example above, @PicoI2 WDYT? |
IMO, there's no concept of optionality with non-tuple arrays. A Although, adding the optional modifier ( So, IMO, |
You are right, I did not saw this case. But as the option is
I totally agree, but making |
Yeah true, setting the default value to But yeah, to be on the safer side we can keep it as an option, and in v5 we can either totally remove the option or flip the default value.
How about |
Co-authored-by: Som Shekhar Mukherjee <[email protected]>
…edInNonTupleArrays`
f332af5
to
64e4316
Compare
bb180f4
to
a6a1b8b
Compare
Co-authored-by: Som Shekhar Mukherjee <[email protected]>
Co-authored-by: Som Shekhar Mukherjee <[email protected]>
allowUndefinedInArrays
to PartialDeep
PartialDeep
: Add allowUndefinedInArrays
option
Add option
allowUndefinedInArrays
toPartialDeep
, default to true to respect backward compatibility.PartialDeep with recurseIntoArrays option works like this
But it can be annoying that
undefined
type could be allowed in an array of string.So with this new option
allowUndefinedInArrays: false
, thelanguages
array is still optional, but typeundefined
is not allowed anymore into thelanguages
array.