From c6d0a15f0ae762de74b04ad218562e4a07c6a66b Mon Sep 17 00:00:00 2001 From: QuiiBz Date: Thu, 17 Aug 2023 08:33:02 +0000 Subject: [PATCH] fix(use-i18n): oom when running eslint --- .changeset/chilly-tigers-bathe.md | 5 +++++ packages/use-i18n/src/types.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/chilly-tigers-bathe.md diff --git a/.changeset/chilly-tigers-bathe.md b/.changeset/chilly-tigers-bathe.md new file mode 100644 index 000000000..f689c9323 --- /dev/null +++ b/.changeset/chilly-tigers-bathe.md @@ -0,0 +1,5 @@ +--- +'@scaleway/use-i18n': patch +--- + +Fix OOM when running eslint diff --git a/packages/use-i18n/src/types.ts b/packages/use-i18n/src/types.ts index 2c6ea1bb6..272a6f1df 100644 --- a/packages/use-i18n/src/types.ts +++ b/packages/use-i18n/src/types.ts @@ -3,11 +3,16 @@ import type { LocaleKeys, LocaleValue, Params, - ScopedValue, Scopes, } from 'international-types' import type { ReactNode } from 'react' +export type ScopedValue< + Locale extends BaseLocale, + Scope extends Scopes | undefined, + Key extends LocaleKeys, +> = Scope extends undefined ? Locale[Key] : Locale[`${Scope}.${Key}`] + export type ReactParamsObject = Record< Params[number], LocaleValue | ReactNode