Created
April 4, 2021 04:28
-
-
Save njbmartin/c455c8b937c5fff7cb236e81df3e3aa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Person { | |
firstName: string; | |
lastName: string; | |
email: string; | |
phone: string; | |
} | |
const person: Person = { | |
firstName: "Jane", | |
lastName: "Bloggs", | |
email: "jane@example.com", | |
phone: "0123456789" | |
}; | |
console.log(person); | |
// expected output: email is a property | |
const personWithoutEmail: Omit<Person, "email"> = person | |
console.log(personWithoutEmail); | |
// expected output: email is not a property | |
// actual output: email is not a property, but is still part of the object. Oops! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment