DefinitelyTyped/react-i18next/index.d.ts
Eric Anderson 9b53298395 Support Pick<> on setState now that TS 2.1 is out (#13155)
* Support Partial<> on setState now that TS 2.1 is out

* Update readme to reflect setState being typed correctly

* Switch setState to Pick

* Restore cloneELement portion of readme

* Use Pick<> | S for setState due to cast issue

* state and props should be readonly

* Fix nit + document why we

* Add typescript compiler header

* Update to properly order headers

* Update readme to reflect 2.1.5 fixing stPick

* Update readme now that 2.1.5 is out

* All that depend on react now require 2.1

* Fix definition that fails due to readonly state
2017-01-23 12:36:53 -08:00

59 lines
1.9 KiB
TypeScript

// Type definitions for react-i18next 1.7.0
// Project: https://github.com/i18next/react-i18next
// Definitions by: Kostya Esmukov <https://github.com/KostyaEsmukov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import * as I18next from "i18next";
import * as React from "react";
import * as ReactRouter from "react-router";
export type TranslationFunction = I18next.TranslationFunction;
// Extend your component's Prop interface with this one to get access to `this.props.t`
//
// Please note that if you use the `translateFuncName` option, you should create
// your own interface just like this one, but with your name of the translation function.
//
// interface MyComponentProps extends ReactI18next.InjectedTranslateProps {}
export interface InjectedTranslateProps {
t?: TranslationFunction;
}
interface I18nextProviderProps {
i18n: I18next.I18n;
children?: React.ReactElement<any>;
}
export class I18nextProvider extends React.Component<I18nextProviderProps, {}> { }
type InterpolateValue = string | JSX.Element;
interface InterpolateProps {
i18nKey: string;
parent?: string;
regexp?: RegExp;
options?: I18next.TranslationOptions;
useDangerouslySetInnerHTML?: boolean;
dangerouslySetInnerHTMLPartElement?: string;
[regexKey: string]: InterpolateValue | RegExp | I18next.TranslationOptions | boolean | undefined;
}
export class Interpolate extends React.Component<InterpolateProps, {}> { }
interface TranslateOptions {
withRef?: boolean;
wait?: boolean;
translateFuncName?: string;
}
export function translate(namespaces?: string[] | string, options?: TranslateOptions): <C extends Function>(WrappedComponent: C) => C;
export function loadNamespaces({ components, i18n }: { components: ReactRouter.RouteComponent[], i18n: I18next.I18n }): Promise<void>;
export as namespace ReactI18Next;