Looking for some clarification on the types used in this code snippet:
interface UserDTO {
id: string;
email: string;
}
const input: Partial<UserDTO> = {};
const userDTO: Partial<UserDTO> = { id: "", ...input };
const email = userDTO.email;
I was expecting the email
variable to be of type string | undefined
, but it seems to be just string
. What could be causing this discrepancy?