UNPKG

1.41 kBTypeScriptView Raw
1import * as React from 'react';
2import { IntlShape } from '../types';
3export declare const Provider: React.Provider<IntlShape>;
4export declare const Context: React.Context<IntlShape>;
5export interface Opts<IntlPropName extends string = 'intl', ForwardRef extends boolean = false> {
6 intlPropName?: IntlPropName;
7 forwardRef?: ForwardRef;
8 enforceContext?: boolean;
9}
10export declare type WrappedComponentProps<IntlPropName extends string = 'intl'> = {
11 [k in IntlPropName]: IntlShape;
12};
13export declare type WithIntlProps<P> = Omit<P, keyof WrappedComponentProps> & {
14 forwardedRef?: React.Ref<any>;
15};
16export default function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>>(WrappedComponent: React.ComponentType<P>, options?: Opts<IntlPropName, false>): React.FC<WithIntlProps<P>> & {
17 WrappedComponent: React.ComponentType<P>;
18};
19export default function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>, T extends React.ComponentType<P> = any>(WrappedComponent: React.ComponentType<P>, options?: Opts<IntlPropName, true>): React.ForwardRefExoticComponent<React.PropsWithoutRef<WithIntlProps<React.PropsWithChildren<P>>> & React.RefAttributes<T>> & {
20 WrappedComponent: React.ComponentType<P>;
21};
22//# sourceMappingURL=injectIntl.d.ts.map
\No newline at end of file