Skip to content

Commit

Permalink
types: emit function can have additional arguments #1993
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Jul 12, 2023
1 parent 24a52e9 commit 01e32f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 23.2.10

- types: emit function can have additional arguments [1993](https://github.com/i18next/i18next/issues/1993)

## 23.2.9

- types: Add brand to TFunction type so different namespaces' TFunctions are not treated as compatible [1994](https://github.com/i18next/i18next/pull/1994)
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ export interface i18n {
/**
* Emit event
*/
emit(eventName: string): void;
emit(eventName: string, ...args: any[]): void;
}

declare const i18next: i18n;
Expand Down
5 changes: 5 additions & 0 deletions test/typescript/exposed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ formatter!.addCached(
'test',
(lng: string | undefined, options: any) => (value: any) => 'formatted',
);

i18next.on('custom', (arg) => {});
i18next.emit('custom');
i18next.emit('custom', { some: 'opt' });
i18next.emit('custom', { some: 'opt' }, { more: 'stuff' });

0 comments on commit 01e32f4

Please sign in to comment.