refactor: remove all any types, add strict GraphQL scalar typing
All checks were successful
Build Docker Image / build (push) Successful in 4m3s
All checks were successful
Build Docker Image / build (push) Successful in 4m3s
- Add strictScalars: true to codegen.ts with proper scalar mappings (Date, Decimal, JSONString, JSON, UUID, BigInt → string/Record) - Replace all ref<any[]> with proper GraphQL-derived types - Add type guards for null filtering in arrays - Fix bugs exposed by typing (locationLatitude vs latitude, etc.) - Add interfaces for external components (MapboxSearchBox) This enables end-to-end type safety from GraphQL schema to frontend.
This commit is contained in:
@@ -95,6 +95,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { GetTeamTransactionsQueryResult } from '~/composables/graphql/team/billing-generated'
|
||||
|
||||
type Transaction = NonNullable<NonNullable<GetTeamTransactionsQueryResult['teamTransactions']>[number]>
|
||||
|
||||
definePageMeta({
|
||||
layout: 'topnav',
|
||||
middleware: ['auth-oidc']
|
||||
@@ -112,7 +116,7 @@ const balance = ref({
|
||||
exists: false
|
||||
})
|
||||
|
||||
const transactions = ref<any[]>([])
|
||||
const transactions = ref<Transaction[]>([])
|
||||
|
||||
const formatCurrency = (amount: number) => {
|
||||
// Amount is in kopecks, convert to base units
|
||||
@@ -130,7 +134,7 @@ const formatAmount = (amount: number) => {
|
||||
}).format(amount / 100)
|
||||
}
|
||||
|
||||
const formatTimestamp = (timestamp: number) => {
|
||||
const formatTimestamp = (timestamp: number | null | undefined) => {
|
||||
if (!timestamp) return '—'
|
||||
// TigerBeetle timestamp is in nanoseconds since epoch
|
||||
const date = new Date(timestamp / 1000000)
|
||||
@@ -157,8 +161,8 @@ const loadBalance = async () => {
|
||||
if (data.value?.teamBalance) {
|
||||
balance.value = data.value.teamBalance
|
||||
}
|
||||
} catch (e: any) {
|
||||
error.value = e.message || t('billing.errors.load_failed')
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : t('billing.errors.load_failed')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
@@ -171,7 +175,7 @@ const loadTransactions = async () => {
|
||||
|
||||
if (txError.value) throw txError.value
|
||||
|
||||
transactions.value = data.value?.teamTransactions || []
|
||||
transactions.value = (data.value?.teamTransactions || []).filter((tx): tx is Transaction => tx !== null)
|
||||
} catch (e) {
|
||||
console.error('Failed to load transactions', e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user