Skip to content

Instantly share code, notes, and snippets.

@michal-wrzosek
Created February 26, 2019 07:45
Show Gist options
  • Save michal-wrzosek/d4e3ce0865c5129e34ff0bfd9ab43861 to your computer and use it in GitHub Desktop.
Save michal-wrzosek/d4e3ce0865c5129e34ff0bfd9ab43861 to your computer and use it in GitHub Desktop.
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type ExampleProps = {
items: string[];
providedByHOC: string;
alsoProvidedByHOC: number;
};
type ExamplePropsWithoutHOCProps = Omit<ExampleProps, 'providedByHOC' | 'alsoProvidedByHOC'>;
// If your HOC props are typed you can also do:
type PropsProvidedByHOC = {
providedByHOC: string;
alsoProvidedByHOC: number;
};
type AnotherExamplePropsWithoutHOCProps = Omit<ExampleProps, keyof PropsProvidedByHOC>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment