Created
January 16, 2019 10:34
-
-
Save tswistak/ce4063932a8155323a1419e82a5e3063 to your computer and use it in GitHub Desktop.
Avoiding any in TypeScript, listing 7
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
type C = { a: string; b: string; c: boolean; d: string; } | |
type D = { b: string; c: boolean; } | |
type pickCkeys = Pick<C, 'c'> | |
type pickCD = Pick<C, keyof D>; | |
const c: pickCkeys = { c: true }; // a, b, d doesn't exist | |
const d: pickCD = { b: 'a', c: true }; // a, d doesn't exist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment