// @flow strict /* eslint-disable no-redeclare */ import * as React from 'react'; import hoistStatics from 'hoist-non-react-statics'; import type { I18nType } from './types'; import { I18nContext } from './I18nProvider'; type InjectedProps = { i18n: I18nType }; declare class TranslatedComponent extends React$Component { static WrappedComponent: Class>; static displayName: ?string; props: OP; state: void; } declare type TranslatedComponentClass = Class>; function translate>( WrappedComponent: Com ): TranslatedComponentClass<$Diff, InjectedProps>> { const name = WrappedComponent.displayName || WrappedComponent.name || 'Component'; class Translate extends React.Component< $Diff, InjectedProps> > { static WrappedComponent = WrappedComponent; static displayName = `Translate(${name})`; render() { const { innerRef, ...restProps } = this.props; return ( {i18n => ( )} ); } } return (hoistStatics(Translate, WrappedComponent): any); } export default translate;