Skip to content

Commit

Permalink
Simplify the Omit type
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikkel committed Feb 4, 2019
1 parent 70deeb2 commit e47d6a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/hoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Omit } from './types'

export interface WithTranslateProps extends I18nContextProps {}

function withTranslate<P extends WithTranslateProps>(
BaseComponent: React.ComponentType<P>
function withTranslate<P extends object>(
BaseComponent: React.ComponentType<P & WithTranslateProps>
): React.ComponentType<Omit<P, keyof WithTranslateProps>> {
return class WithTranslate extends React.Component<P> {
static displayName = `withTranslate(${BaseComponent.displayName})`
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ export type TranslatePluralJsxFunc = (
context?: string
) => ReactNode

export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>

0 comments on commit e47d6a1

Please sign in to comment.