Created
September 12, 2021 15:03
-
-
Save tamert/d7c4f95b4aac0f25b8786d6fb11008de to your computer and use it in GitHub Desktop.
Pick
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 Book { | |
id: number; | |
title: string; | |
subject?: 'crime' | 'comedy'; | |
body: string; | |
} | |
type BookPreview = Pick<Book, "title" | "subject">; | |
const book: BookPreview = { | |
title: "Arsène Lupin, Gentleman Burglar", | |
subject: 'comedy', | |
}; | |
console.log(book) | |
/** | |
* { | |
"title": "Arsène Lupin, Gentleman Burglar", | |
"subject": "comedy" | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment