Skip to content

Instantly share code, notes, and snippets.

@MikeyBurkman
Last active September 11, 2019 13:19
Show Gist options
  • Save MikeyBurkman/fa9a9ce280c96cbe40274cdd1da0c63a to your computer and use it in GitHub Desktop.
Save MikeyBurkman/fa9a9ce280c96cbe40274cdd1da0c63a to your computer and use it in GitHub Desktop.
Ban Props TS
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