Skip to content

Commit

Permalink
Add/fix optional i18n prop on NamespacesConsumer
Browse files Browse the repository at this point in the history
  • Loading branch information
rosskevin committed Dec 31, 2018
1 parent b71a7c1 commit 7385205
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const translate: typeof withNamespaces;

export interface NamespacesConsumerProps extends ReactI18NextOptions {
ns?: Namespace;
i18n?: i18next.i18n;
initialI18nStore?: {};
initialLanguage?: string;
children(
Expand Down
12 changes: 12 additions & 0 deletions test/typescript/NamespacesConsumer.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import i18next from "i18next";
import * as React from "react";
import { NamespacesConsumer } from "../../src/index";

function withi18nProp() {
// const i18n = i18next.init({});
return (
<NamespacesConsumer i18n={i18next}>
{(t) => <h2>{t("title")}</h2>}
</NamespacesConsumer>
);
}

0 comments on commit 7385205

Please # to comment.