Skip to content

Commit

Permalink
Re-allow unknown keys, when a defaultValue is provided #1867
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Jun 29, 2023
1 parent bf17cf1 commit 06d997d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## 23.2.6

- Re-allow unknown keys, when a defaultValue is provided [1867](https://github.com/i18next/i18next/issues/1867)

## 23.2.5

- Clean language code before passing to formatters [1985](https://github.com/i18next/i18next/pull/1988)
- Clean language code before passing to formatters [1988](https://github.com/i18next/i18next/pull/1988)

## 23.2.4

Expand Down
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,8 @@ export interface TFunction<Ns extends Namespace = _DefaultNamespace, KPrefix = u
...args:
| [key: Key | Key[], options?: TOpt & InterpolationMap<Ret>]
| [key: Key | Key[], defaultValue: string, options?: TOpt & InterpolationMap<Ret>]
| [key: string | string[], options: TOpt & InterpolationMap<Ret> & { defaultValue: string }]
| [key: string | string[], defaultValue: string, options?: TOpt & InterpolationMap<Ret>]
): TFunctionReturnOptionalDetails<Ret, TOpt>;
}

Expand Down
3 changes: 3 additions & 0 deletions test/typescript/custom-types/t.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ function expectErrorWhenKeyNotInNamespace(t: TFunction<'alternate'>) {

t('foobar.barfoo', 'some default value');
t('foobar.barfoo', { defaultValue: 'some default value' });

t('new.key', { defaultValue: 'some default value' });
t('new.key', 'some default value');
}

function i18nextTUsage() {
Expand Down

0 comments on commit 06d997d

Please sign in to comment.