Created
January 16, 2019 10:38
-
-
Save tswistak/f6b80b59271d6fd8f82e72c4dadc6a0b to your computer and use it in GitHub Desktop.
Avoiding any in TypeScript, listing 10
This file contains hidden or 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 ComitKeys = Omit<C, 'c'>; | |
type ComitD = Omit<C, keyof D>; | |
const e: ComitKeys = { a: 'b', b: 'b', d: 'd' }; // c doesn't exist | |
const f: ComitD = { a: 'b', d: 'd' }; // b, c doesn't exist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment