diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.ts index b46d385432..143f89950b 100644 --- a/apps/api/src/app/subscription/subscription.service.ts +++ b/apps/api/src/app/subscription/subscription.service.ts @@ -23,6 +23,8 @@ import { addMilliseconds, isBefore } from 'date-fns'; import ms, { StringValue } from 'ms'; import Stripe from 'stripe'; +import { StringLiteral } from './types/string-literal.type'; + @Injectable() export class SubscriptionService { private readonly logger = new Logger(SubscriptionService.name); @@ -268,7 +270,7 @@ export class SubscriptionService { const unsupportedLanguageCodes: Record< Exclude< (typeof SUPPORTED_LANGUAGE_CODES)[number], - Stripe.Checkout.SessionCreateParams.Locale + StringLiteral >, true > = { diff --git a/apps/api/src/app/subscription/types/string-literal.type.ts b/apps/api/src/app/subscription/types/string-literal.type.ts new file mode 100644 index 0000000000..1f25cb81a4 --- /dev/null +++ b/apps/api/src/app/subscription/types/string-literal.type.ts @@ -0,0 +1,7 @@ +// Removes the open string type (e.g. OtherString of Stripe), which matches +// every string, and keeps only the string literals +export type StringLiteral = T extends string + ? string extends T + ? never + : T + : never;