The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Type issues
Jonathan Summers-Muir907ef0996552
diff --git a/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.tsx b/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.tsxindex 64d99fec28b..0ddc5682fe1 100644--- a/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.tsx+++ b/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.tsx@@ -3,14 +3,14 @@ import dayjs from 'dayjs'import { Typography } from '@supabase/ui'import ChartHandler from 'components/to-be-cleaned/Charts/ChartHandler'-import { ChargeableProduct, ProductFeature } from './PAYGUsage.types'+import { ChargeableProduct, PaygStats, ProductFeature } from './PAYGUsage.types'import { deriveProductCost } from './PAYGUsage.utils'import { chargeableProducts } from './PAYGUsage.constants'import { DATE_FORMAT } from 'lib/constants'import { Dictionary } from '@supabase/grid'interface Props {- paygStats: Dictionary<number>+ paygStats: PaygStats}const PAYGUsage: FC<Props> = ({ paygStats }) => {diff --git a/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.utils.ts b/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.utils.tsindex e871bfe88ad..ff60a4905ed 100644--- a/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.utils.ts+++ b/studio/components/interfaces/Billing/PAYGUsage/PAYGUsage.utils.ts@@ -11,8 +11,8 @@ import { ChargeableProduct, PaygStats, ProductFeature } from './PAYGUsage.types'** @returns number*/-export const deriveFeatureCost = (paygStats: PaygStats, feature: ProductFeature) => {- const maximumValueOfTheMonth = paygStats?.[feature.attribute][feature.pricingModel] ?? 0+export const deriveFeatureCost = (paygStats: PaygStats | undefined, feature: ProductFeature) => {+ const maximumValueOfTheMonth = paygStats?.[feature.attribute]?.[feature.pricingModel] ?? 0return (maximumValueOfTheMonth / feature.unitQuantity) * feature.costPerUnit}diff --git a/studio/components/interfaces/Billing/Subscription/Subscription.tsx b/studio/components/interfaces/Billing/Subscription/Subscription.tsxindex a8233c62e6f..437b6bc4381 100644--- a/studio/components/interfaces/Billing/Subscription/Subscription.tsx+++ b/studio/components/interfaces/Billing/Subscription/Subscription.tsx@@ -17,7 +17,7 @@ import { PaygStats } from '../PAYGUsage/PAYGUsage.types'interface Props {project: anysubscription: StripeSubscription- paygStats?: PaygStats+ paygStats: PaygStats | undefinedloading?: booleanshowProjectName?: booleancurrentPeriodStart: numberdiff --git a/studio/hooks/queries/useProjectPaygStatistics.ts b/studio/hooks/queries/useProjectPaygStatistics.tsindex 750f88a3ee5..ef23cb854c4 100644--- a/studio/hooks/queries/useProjectPaygStatistics.ts+++ b/studio/hooks/queries/useProjectPaygStatistics.ts@@ -5,6 +5,7 @@ import { get } from 'lib/common/fetch'import { API_URL, DATE_FORMAT, PRICING_TIER_PRODUCT_IDS } from 'lib/constants'import { chargeableProducts } from 'components/interfaces/Billing'import { Dictionary } from '@supabase/grid'+import { PaygStats } from 'components/interfaces/Billing/PAYGUsage/PAYGUsage.types'/*** Get project payg statistics@@ -44,7 +45,7 @@ export function useProjectPaygStatistics(ref?: string, tierProdId?: string) {}}-function getPaygStats(data: any): Dictionary<number> {+function getPaygStats(data: any): PaygStats {const paygStats: any = {}if (!data) return paygStatsdiff --git a/studio/pages/project/[ref]/settings/billing/index.tsx b/studio/pages/project/[ref]/settings/billing/index.tsxindex 0acccb90b46..2dfdf845b5e 100644--- a/studio/pages/project/[ref]/settings/billing/index.tsx+++ b/studio/pages/project/[ref]/settings/billing/index.tsx@@ -11,6 +11,7 @@ import { PAYGUsage, Subscription, Invoices } from 'components/interfaces/Billingimport ProjectUsage from 'components/to-be-cleaned/Usage'import DateRangePicker from 'components/to-be-cleaned/DateRangePicker'+import { PaygStats } from 'components/interfaces/Billing/PAYGUsage/PAYGUsage.types'type ProjectBillingProps = {} & anyconst ProjectBilling: FC<ProjectBillingProps> = ({ store }) => {@@ -40,7 +41,7 @@ const Settings: FC<SettingsProps> = ({ project }) => {isLoading: loading,error,} = useProjectSubscription(ui.selectedProject?.ref)- const { paygStats } = useProjectPaygStatistics(+ const { paygStats }: { paygStats: PaygStats | undefined } = useProjectPaygStatistics(ui.selectedProject?.ref,subscription?.tier?.supabase_prod_id)