Is there a way of making the type PrivateUserData incompatible with PublicUserData in the following example, but without adding extra fields to neither of the two?
type PrivateUserData = {
email: string;
password: string;
}
type PublicUserData = {
email: string;
}
function showToTheWorld(data: PublicUserData) {
console.log(data);
}
const superSecretData: PrivateUserData = {
email: '[email protected]',
password: 'password123'
};
showToTheWorld(superSecretData);