Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/type check of unsupported language codes in Stripe checkout session (#8189)

Thomas Kaul42e0c1dbe9e7
diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.ts
index b46d385432..867df56c91 100644
--- a/apps/api/src/app/subscription/subscription.service.ts
+++ b/apps/api/src/app/subscription/subscription.service.ts
@@ -268,7 +268,12 @@ export class SubscriptionService {
const unsupportedLanguageCodes: Record<
Exclude<
(typeof SUPPORTED_LANGUAGE_CODES)[number],
- Stripe.Checkout.SessionCreateParams.Locale
+ // Extract keeps only the Stripe locales that Ghostfolio supports.
+ // This also removes OtherString, which matches every string.
+ Extract<
+ Stripe.Checkout.SessionCreateParams.Locale,
+ (typeof SUPPORTED_LANGUAGE_CODES)[number]
+ >
>,
true
> = {