Skip to content

Commit 62b5029

Browse files
committed
Revert "Export TFunction and all types"
This reverts commit 47ae8ac.
1 parent 495ccd7 commit 62b5029

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

dist/brackets-viewer.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,16 @@ window.inMemoryDatabase = new InMemoryDatabase();
77
window.bracketsManager = new BracketsManager(window.inMemoryDatabase);
88

99
export { BracketsViewer };
10-
export * from './types';
10+
export { ToI18nKey } from './lang';
11+
export {
12+
Config,
13+
MatchClickCallback,
14+
Placement,
15+
ViewerData,
16+
ParticipantImage,
17+
RoundNameInfo,
18+
MatchWithMetadata,
19+
Connection,
20+
ConnectionType,
21+
OriginHint,
22+
} from './types';

src/lang.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import i18next, { StringMap, TOptions, TFunction } from 'i18next';
1+
import i18next, { StringMap, TOptions } from 'i18next';
22
import LanguageDetector from 'i18next-browser-languagedetector';
33

44
import { Stage, Status, FinalType, GroupType, StageType } from 'brackets-model';
@@ -8,8 +8,6 @@ import { OriginHint, RoundNameInfo } from './types';
88
import en from './i18n/en/translation.json';
99
import fr from './i18n/fr/translation.json';
1010

11-
export type { TFunction } from 'i18next';
12-
1311
export const locales = {
1412
en,
1513
fr,
@@ -53,6 +51,8 @@ export function t<Scope extends keyof Locale, SubKey extends string & keyof Loca
5351
return i18next.t(key, options);
5452
}
5553

54+
export type Translator = typeof t;
55+
5656
export type ToI18nKey<S extends string> = S extends `${infer A}_${infer B}`
5757
? `${A}-${B}`
5858
: never;
@@ -235,22 +235,22 @@ export function getBracketName(stage: Stage, type: GroupType): string | undefine
235235
/**
236236
* Returns the name of a round.
237237
*/
238-
export function getRoundName({ roundNumber, roundCount }: RoundNameInfo, t: TFunction): string {
238+
export function getRoundName({ roundNumber, roundCount }: RoundNameInfo, t: Translator): string {
239239
return roundNumber === roundCount ? t('common.round-name-final') : t('common.round-name', { roundNumber });
240240
}
241241

242242
// eslint-disable-next-line jsdoc/require-param
243243
/**
244244
* Returns the name of a round in the winner bracket of a double elimination stage.
245245
*/
246-
export function getWinnerBracketRoundName({ roundNumber, roundCount }: RoundNameInfo, t: TFunction): string {
246+
export function getWinnerBracketRoundName({ roundNumber, roundCount }: RoundNameInfo, t: Translator): string {
247247
return roundNumber === roundCount ? t('common.round-name-winner-bracket-final') : t('common.round-name-winner-bracket', { roundNumber });
248248
}
249249

250250
// eslint-disable-next-line jsdoc/require-param
251251
/**
252252
* Returns the name of a round in the loser bracket of a double elimination stage.
253253
*/
254-
export function getLoserBracketRoundName({ roundNumber, roundCount }: RoundNameInfo, t: TFunction): string {
254+
export function getLoserBracketRoundName({ roundNumber, roundCount }: RoundNameInfo, t: Translator): string {
255255
return roundNumber === roundCount ? t('common.round-name-loser-bracket-final') : t('common.round-name-loser-bracket', { roundNumber });
256256
}

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CallbackFunction, FormConfiguration } from './form';
33
import { InMemoryDatabase } from 'brackets-memory-db';
44
import { BracketsViewer } from './main';
55
import { BracketsManager } from 'brackets-manager';
6-
import { ToI18nKey, TFunction } from './lang';
6+
import { ToI18nKey, Translator } from './lang';
77

88
export type { ToI18nKey, TFunction };
99

@@ -246,7 +246,7 @@ export type RoundNameInfo = {
246246
/**
247247
* A function returning a round name based on its number and the count of rounds.
248248
*/
249-
export type RoundNameGetter = (info: RoundNameInfo, t: TFunction) => string;
249+
export type RoundNameGetter = (info: RoundNameInfo, t: Translator) => string;
250250

251251
/**
252252
* A function called when a match is clicked.

0 commit comments

Comments
 (0)