diff --git a/types/lingui__react/I18n.d.ts b/types/lingui__react/I18n.d.ts new file mode 100644 index 0000000000..617b7be7a2 --- /dev/null +++ b/types/lingui__react/I18n.d.ts @@ -0,0 +1,11 @@ +import { Component, ReactNode } from 'react'; +import { I18n } from '@lingui/core'; + +// tslint:disable-next-line:interface-name +export interface I18nComponentProps { + children: ({ i18n, i18nHash }: { i18n: I18n, i18nHash?: string }) => ReactNode; + update?: boolean; + withHash?: boolean; +} + +export default class I18nComponent extends Component {} diff --git a/types/lingui__react/index.d.ts b/types/lingui__react/index.d.ts index 1fbe1e5c05..da40b247ce 100644 --- a/types/lingui__react/index.d.ts +++ b/types/lingui__react/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @lingui/react 2.1 +// Type definitions for @lingui/react 2.5 // Project: https://lingui.github.io/js-lingui/ // Definitions by: Jeow Li Huan // Definitions: https://github.com/huan086/lingui-typings @@ -9,7 +9,7 @@ import { ComponentClass } from 'react'; import { FormatPropsWithoutI18n } from './createFormat'; export { default as withI18n, withI18nProps } from './withI18n'; - +export { default as I18n } from './I18n'; export { default as I18nProvider } from './I18nProvider'; export { default as Trans } from './Trans'; export { Plural, Select, SelectOrdinal } from './Select'; diff --git a/types/lingui__react/lingui__react-tests.tsx b/types/lingui__react/lingui__react-tests.tsx index 3fc8cebebb..2d414006a7 100644 --- a/types/lingui__react/lingui__react-tests.tsx +++ b/types/lingui__react/lingui__react-tests.tsx @@ -3,6 +3,7 @@ import { Catalog, Catalogs, I18n } from '@lingui/core'; import { withI18n, I18nProvider, + I18n as I18nComponent, Trans, Plural, Select, @@ -42,10 +43,16 @@ const App = () => { const gender = 'male'; const price = 21.35; const lastLogin = new Date(); + const age = 23; return ( - - + + + + {({ i18n }) => ( + Attributes + )} + Name {name} in Trans. Name {name} in Trans with id.