Closed Olesj-Bilous closed 1 year ago
I am fairly sure the purpose of the type is to allow the output type to be assignable to types that are missing properties we know are undefined, meaning optional fields produce a type that optionally has those properties, but yup should still output an object with all the schema keys, even if they are undefined. You'd need to double that tho
Alright, thanks for the clarification!
As below, so in the sandbox:
I'm not sure if this is intended behavior. I couldn't find it documented anywhere. From the type definitions, it seems
MakeKeysOptional
allows for all keys with potentially undefined values to be optional.Does this mean I should take care not to iterate over keys that may not be defined when casting to T? Are there any other implications or best practices surrounding this?