Comparing version 23.7.16 to 23.7.17
@@ -1,1 +0,1 @@ | ||
{"type":"module","version":"23.7.16"} | ||
{"type":"module","version":"23.7.17"} |
// Internal Helpers | ||
import type { $Dictionary } from './typescript/helpers.js'; | ||
import type { $Dictionary, $NormalizeIntoArray } from './typescript/helpers.js'; | ||
import type { | ||
@@ -220,8 +220,18 @@ DefaultNamespace, | ||
export interface CustomInstanceExtenstions {} | ||
export interface CustomInstanceExtensions {} | ||
// Used just here to exclude `DefaultNamespace` which can be both string or array from `FlatNamespace` | ||
// in TFunction declaration below. | ||
// Due to this only very special usage I'm not moving this inside helpers. | ||
type InferArrayValuesElseReturnType<T> = T extends (infer A)[] ? A : T; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export interface i18n extends CustomInstanceExtenstions { | ||
export interface i18n extends CustomInstanceExtensions { | ||
// Expose parameterized t in the i18next interface hierarchy | ||
t: TFunction<[DefaultNamespace, ...Exclude<FlatNamespace, DefaultNamespace>[]]>; | ||
t: TFunction< | ||
[ | ||
...$NormalizeIntoArray<DefaultNamespace>, | ||
...Exclude<FlatNamespace, InferArrayValuesElseReturnType<DefaultNamespace>>[], | ||
] | ||
>; | ||
@@ -228,0 +238,0 @@ /** |
// Internal Helpers | ||
import type { $Dictionary } from './typescript/helpers.js'; | ||
import type { $Dictionary, $NormalizeIntoArray } from './typescript/helpers.js'; | ||
import type { | ||
@@ -220,8 +220,18 @@ DefaultNamespace, | ||
export interface CustomInstanceExtenstions {} | ||
export interface CustomInstanceExtensions {} | ||
// Used just here to exclude `DefaultNamespace` which can be both string or array from `FlatNamespace` | ||
// in TFunction declaration below. | ||
// Due to this only very special usage I'm not moving this inside helpers. | ||
type InferArrayValuesElseReturnType<T> = T extends (infer A)[] ? A : T; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export interface i18n extends CustomInstanceExtenstions { | ||
export interface i18n extends CustomInstanceExtensions { | ||
// Expose parameterized t in the i18next interface hierarchy | ||
t: TFunction<[DefaultNamespace, ...Exclude<FlatNamespace, DefaultNamespace>[]]>; | ||
t: TFunction< | ||
[ | ||
...$NormalizeIntoArray<DefaultNamespace>, | ||
...Exclude<FlatNamespace, InferArrayValuesElseReturnType<DefaultNamespace>>[], | ||
] | ||
>; | ||
@@ -228,0 +238,0 @@ /** |
{ | ||
"name": "i18next", | ||
"version": "23.7.16", | ||
"version": "23.7.17", | ||
"description": "i18next internationalization framework", | ||
@@ -104,8 +104,9 @@ "main": "./dist/cjs/i18next.js", | ||
"scripts": { | ||
"lint": "eslint src typescript \"./*.{ts,mts}\"", | ||
"lint": "eslint src typescript test \"./*.{ts,mts}\"", | ||
"pretest": "npm run generate_ts_v4_index && npm run lint", | ||
"test": "vitest --typecheck --workspace vitest.workspace.mts --run", | ||
"test:runtime": "vitest --workspace vitest.workspace.mts --project runtime", | ||
"test:compatibility": "vitest --workspace vitest.workspace.mts --project compatibility", | ||
"test:coverage": "npm run test:runtime -- --coverage --run", | ||
"test": "vitest --run", | ||
"test:coverage": "vitest --project runtime --project compatibility --coverage --run", | ||
"test:runtime": "vitest --project runtime", | ||
"test:compatibility": "vitest --project compatibility", | ||
"test:local": "vitest --workspace vitest.workspace.local.mts", | ||
"build": "rimraf dist && rollup -c && echo '{\"type\":\"module\"}' > dist/esm/package.json && cpy \"./dist/umd/*.js\" ./", | ||
@@ -112,0 +113,0 @@ "generate_ts_v4_index": "cp index.d.ts index.v4.d.ts && node -e \"fs.writeFileSync('index.v4.d.ts', fs.readFileSync('index.v4.d.ts').toString().replace(/t.js/g, 't.v4.js').replace(/export type \\* /g, '// export type * '))\"", |
@@ -0,5 +1,15 @@ | ||
// Types | ||
export type $Dictionary<T = unknown> = { [key: string]: T }; | ||
export type $SpecialObject = object | Array<string | object>; | ||
// Types Operators | ||
export type $MergeBy<T, K> = Omit<T, keyof K> & K; | ||
export type $Dictionary<T = unknown> = { [key: string]: T }; | ||
export type $OmitArrayKeys<Arr> = Arr extends readonly any[] ? Omit<Arr, keyof any[]> : Arr; | ||
export type $PreservedValue<Value, Fallback> = [Value] extends [never] ? Fallback : Value; | ||
export type $SpecialObject = object | Array<string | object>; | ||
export type $NormalizeIntoArray<T extends unknown | unknown[]> = T extends unknown[] ? T : [T]; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
616554
13931