Skip to content

Commit 784c4fd

Browse files
lohanidamodarclaude
andcommitted
fix: correct type annotations for payment method promises
Promise type should include null for both the resolved value (.catch(() => null)) and the ternary false branch (null). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 56c959e commit 784c4fd

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

  • src/routes/(console)/organization-[organization]/billing

src/routes/(console)/organization-[organization]/billing/+page.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,17 @@ export const load: PageLoad = async ({ parent, depends, url, route }) => {
7070

7171
const areCreditsSupported = isCloud ? currentPlan?.supportsCredits : false;
7272

73-
const primaryPaymentMethodPromise: Promise<Models.PaymentMethod> = organization.paymentMethodId
74-
? sdk.forConsole.organizations
75-
.getPaymentMethod({
76-
organizationId: organization.$id,
77-
paymentMethodId: organization.paymentMethodId
78-
})
79-
.catch(() => null)
80-
: null;
73+
const primaryPaymentMethodPromise: Promise<Models.PaymentMethod | null> | null =
74+
organization.paymentMethodId
75+
? sdk.forConsole.organizations
76+
.getPaymentMethod({
77+
organizationId: organization.$id,
78+
paymentMethodId: organization.paymentMethodId
79+
})
80+
.catch(() => null)
81+
: null;
8182

82-
const backupPaymentMethodPromise: Promise<Models.PaymentMethod> =
83+
const backupPaymentMethodPromise: Promise<Models.PaymentMethod | null> | null =
8384
organization.backupPaymentMethodId
8485
? sdk.forConsole.organizations
8586
.getPaymentMethod({

0 commit comments

Comments
 (0)