Last active
September 11, 2019 13:19
-
-
Save MikeyBurkman/fa9a9ce280c96cbe40274cdd1da0c63a to your computer and use it in GitHub Desktop.
Ban Props TS
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
export type BanProps<T extends string> = { [P in T]: never } & { | |
[key: string]: any; | |
}; | |
interface Foo { | |
x: string; | |
y: number; | |
} | |
export type NotFoo = BanProps<keyof Foo>; | |
const n: NotFoo = { | |
blarg: true, // Fine | |
x: 'abc', // NO | |
y: 4 // NO | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment