Skip to content

Commit

Permalink
fix(i18next): update dependency i18next to v22 (#383)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This package now depends on i18next v22, please refer to https://github.com/i18next/i18next/blob/HEAD/CHANGELOG.md#2200 for further breaking changes
  • Loading branch information
renovate[bot] committed Oct 23, 2022
1 parent bcde7ef commit f958106
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 228 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -28,7 +28,7 @@
"@sapphire/stopwatch": "^1.5.0",
"@sapphire/ts-config": "^3.3.4",
"@sapphire/utilities": "^3.11.0",
"@types/node": "^18.11.0",
"@types/node": "^18.11.3",
"@types/node-fetch": "^2.6.2",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.40.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/i18next/package.json
Expand Up @@ -39,9 +39,9 @@
},
"dependencies": {
"@sapphire/utilities": "^3.11.0",
"@skyra/i18next-backend": "^1.1.0",
"@skyra/i18next-backend": "^2.0.0",
"chokidar": "^3.5.3",
"i18next": "^21.10.0",
"i18next": "^22.0.2",
"tslib": "^2.4.0"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/i18next/src/index.ts
@@ -1,4 +1,4 @@
export { StringMap, TFunction, TFunctionKeys, TFunctionResult, TOptions } from 'i18next';
export { TFunction, TOptions } from 'i18next';
export * from './lib/functions';
export * from './lib/InternationalizationHandler';
export * from './lib/types';
4 changes: 2 additions & 2 deletions packages/i18next/src/lib/InternationalizationHandler.ts
Expand Up @@ -2,11 +2,11 @@ import { Result } from '@sapphire/framework';
import { container, getRootData } from '@sapphire/pieces';
import { Awaitable, isFunction, NonNullObject } from '@sapphire/utilities';
import { Backend, PathResolvable } from '@skyra/i18next-backend';
import i18next, { StringMap, TFunction, TFunctionKeys, TFunctionResult, TOptions } from 'i18next';
import i18next, { TFunction, TOptions } from 'i18next';
import type { PathLike } from 'node:fs';
import { opendir } from 'node:fs/promises';
import { join } from 'node:path';
import type { InternationalizationContext, InternationalizationOptions } from './types';
import type { InternationalizationContext, InternationalizationOptions, StringMap, TFunctionKeys, TFunctionResult } from './types';

/**
* A generalized class for handling `i18next` JSON files and their discovery.
Expand Down
7 changes: 5 additions & 2 deletions packages/i18next/src/lib/functions.ts
Expand Up @@ -2,14 +2,17 @@ import { container } from '@sapphire/pieces';
import { lazy, type NonNullObject } from '@sapphire/utilities';
import { APIApplicationCommandOptionChoice, Locale, type LocaleString } from 'discord-api-types/v10';
import { BaseCommandInteraction, Guild, Message, MessageComponentInteraction } from 'discord.js';
import type { StringMap, TFunctionKeys, TFunctionResult, TOptions } from 'i18next';
import type { TOptions } from 'i18next';
import type {
BuilderWithDescription,
BuilderWithName,
BuilderWithNameAndDescription,
InternationalizationContext,
LocalizedData,
Target
StringMap,
Target,
TFunctionKeys,
TFunctionResult
} from './types';

/**
Expand Down
14 changes: 13 additions & 1 deletion packages/i18next/src/lib/types.ts
Expand Up @@ -13,7 +13,19 @@ import type {
User,
VoiceChannel
} from 'discord.js';
import type { InitOptions } from 'i18next';
import type { DefaultTFuncReturn, InitOptions, Namespace, TFuncKey, TFuncReturn, TypeOptions } from 'i18next';

export interface StringMap {
[key: string]: any;
}

export type TFunctionKeys = TFuncKey | TemplateStringsArray extends infer A ? A : never;
export type TFunctionResult<N extends Namespace = TypeOptions['defaultNS'], TKPrefix = undefined> = TFuncReturn<
N,
TFunctionKeys,
DefaultTFuncReturn,
TKPrefix
>;

/**
* Configure whether to use Hot-Module-Replacement (HMR) for your i18next resources using these options. The minimum config to enable HMR is to set `enabled` to true. Any other properties are optional.
Expand Down

0 comments on commit f958106

Please sign in to comment.