Skip to content

Commit

Permalink
fix(types): FormatFunction should allow any value inside options para…
Browse files Browse the repository at this point in the history
…meter (fixes #2074)
  • Loading branch information
marcalexiei committed Dec 6, 2023
1 parent 7b04248 commit 19fa49a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions test/typescript/format.test.ts
@@ -0,0 +1,9 @@
import { FormatFunction } from 'i18next';

export const customFormatFunction: FormatFunction = (value, _, lng, options) => {
const passedOptions = options?.formatParams?.[options.interpolationkey] || {};

// All keys should can be read from options without any error
const randomParameter = options?.random;
return '';
};
2 changes: 1 addition & 1 deletion typescript/options.d.ts
Expand Up @@ -138,7 +138,7 @@ export type FormatFunction = (
value: any,
format?: string,
lng?: string,
options?: InterpolationOptions & $Dictionary,
options?: InterpolationOptions & $Dictionary<any>,
) => string;

export interface InterpolationOptions {
Expand Down

0 comments on commit 19fa49a

Please sign in to comment.