From e036aff6a8fa14249f14a9556392fc3464955198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Connor=20B=C3=A4r?= Date: Wed, 11 Dec 2024 08:48:01 +0100 Subject: [PATCH] Remove accidental default attribute (#2825) --- .changeset/proud-pigs-yell.md | 5 +++++ packages/circuit-ui/util/i18n.ts | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/proud-pigs-yell.md diff --git a/.changeset/proud-pigs-yell.md b/.changeset/proud-pigs-yell.md new file mode 100644 index 0000000000..cb612ff02c --- /dev/null +++ b/.changeset/proud-pigs-yell.md @@ -0,0 +1,5 @@ +--- +"@sumup-oss/circuit-ui": patch +--- + +Removed the `default` attribute that was accidentally added to components with default translations. diff --git a/packages/circuit-ui/util/i18n.ts b/packages/circuit-ui/util/i18n.ts index c2a6770595..5bc764c1ab 100644 --- a/packages/circuit-ui/util/i18n.ts +++ b/packages/circuit-ui/util/i18n.ts @@ -110,7 +110,8 @@ export function transformModulesToTranslations< Key extends string | number | symbol = keyof T, >(modules: Record): Translations { const translations = Object.entries(modules).reduce( - (acc, [importPath, strings]) => { + (acc, [importPath, exports]) => { + const { default: unused, ...strings } = exports; const matches = importPath.match(/[a-z]{2}-[A-Z]{2}/); // @ts-expect-error This environment variable is set by Vite. @@ -128,7 +129,7 @@ export function transformModulesToTranslations< throw new Error(`Unsupported locale: ${importPath}`); } - acc[locale] = strings as Record; + acc[locale] = strings as unknown as Record; return acc; }, {} as Translations,