Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore(billing): remove invoice type casts (#50338)

Julian Domke17280319f07a
diff --git a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.test.tsx b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.test.tsx
index 63a5ea93ea2..137d607f1a8 100644
--- a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.test.tsx
+++ b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.test.tsx
@@ -66,11 +66,9 @@ const createMockInvoice = (details: Partial<Invoice> = {}): Invoice => ({
})
const createMockInvoiceWithoutPdf = (): Invoice => {
- const invoice = createMockInvoice()
- // The API can return null for invoice_pdf. Not reflected in the generated schema yet, but
- // will be soon — drop the cast once the type is nullable.
- ;(invoice as any).invoice_pdf = null
- return invoice
+ return createMockInvoice({
+ invoice_pdf: null,
+ })
}
describe('InvoicesSettings', () => {
diff --git a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
index 9c1ce018275..5ef62a7a3e3 100644
--- a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
+++ b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx
@@ -95,8 +95,9 @@ export const InvoicesSettings = () => {
} else {
toast.error('Invoice PDF is not available yet. Please try again later.')
}
- } catch (error: any) {
- toast.error(`Failed to fetch the selected invoice: ${error.message}`)
+ } catch (error: unknown) {
+ const msg = error instanceof Error ? error.message : 'unknown error'
+ toast.error(`Failed to fetch the selected invoice: ${msg}`)
}
}
@@ -175,8 +176,6 @@ export const InvoicesSettings = () => {
) : (
<>
{invoices.map((x) => {
- // invoice_pdf can be null. Not reflected in the generated schema yet, but will
- // be soon
const hasInvoicePdf = Boolean(x.invoice_pdf)
return (