Optional properties can be missing. Sometimes a field is present but set to null. Treat both as “no value.” When a string is present, you can clean it up.
const raw: string | null | undefined = " [email protected] ";
const cleaned = raw?.trim().toLowerCase();
Return a new object when you make changes so callers keep their old data if needed.
Make a new user object with a normalized email field.