1 | import * as React from 'react';
|
2 | import { IntlShape } from '../types';
|
3 | declare global {
|
4 | interface Window {
|
5 | |
6 |
|
7 |
|
8 | __REACT_INTL_BYPASS_GLOBAL_CONTEXT__: boolean | undefined;
|
9 | __REACT_INTL_CONTEXT__: React.Context<IntlShape> | undefined;
|
10 | }
|
11 | }
|
12 | export declare const Provider: React.Provider<IntlShape>;
|
13 | export declare const Context: React.Context<IntlShape>;
|
14 | export interface Opts<IntlPropName extends string = 'intl', ForwardRef extends boolean = false> {
|
15 | intlPropName?: IntlPropName;
|
16 | forwardRef?: ForwardRef;
|
17 | enforceContext?: boolean;
|
18 | }
|
19 | export type WrappedComponentProps<IntlPropName extends string = 'intl'> = {
|
20 | [k in IntlPropName]: IntlShape;
|
21 | };
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export type DistributedOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
31 | export type WithIntlProps<P> = DistributedOmit<P, keyof WrappedComponentProps> & {
|
32 | forwardedRef?: React.Ref<any>;
|
33 | };
|
34 | export 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>> & {
|
35 | WrappedComponent: React.ComponentType<P>;
|
36 | };
|
37 | export 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>> & {
|
38 | WrappedComponent: React.ComponentType<P>;
|
39 | };
|