From a2e19d7e9a6a8f2843df1aaa803157eee3a035fb Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 25 Feb 2025 11:36:24 +0000 Subject: [PATCH] fix: improve TypeScript type safety across views Changes: - Add proper type annotations for component properties - Fix null checks with optional chaining - Add missing interface properties - Replace any with proper types where possible - Move interfaces from endorserServer to interfaces/ - Add proper Router and Route typing - Add default empty string for optional text fields This improves type safety and reduces TypeScript errors across views. --- src/interfaces/claims.ts | 7 +++- src/interfaces/records.ts | 1 + src/views/ClaimAddRawView.vue | 8 ++-- src/views/ClaimCertificateView.vue | 4 +- src/views/ClaimView.vue | 23 ++++++------ src/views/ConfirmGiftView.vue | 17 +++++---- src/views/GiftedDetailsView.vue | 59 ++++++++++++++---------------- src/views/OfferDetailsView.vue | 37 +++++++++---------- src/views/ProjectViewView.vue | 20 +++++----- 9 files changed, 92 insertions(+), 84 deletions(-) diff --git a/src/interfaces/claims.ts b/src/interfaces/claims.ts index 28322a3..2b14c73 100644 --- a/src/interfaces/claims.ts +++ b/src/interfaces/claims.ts @@ -30,7 +30,12 @@ export interface OfferVerifiableCredential extends GenericVerifiableCredential { includesObject?: { amountOfThisGood: number; unitCode: string }; itemOffered?: { description?: string; - isPartOf?: { identifier?: string; lastClaimId?: string; "@type"?: string }; + isPartOf?: { + identifier?: string; + lastClaimId?: string; + "@type"?: string; + name?: string; + }; }; offeredBy?: { identifier: string }; recipient?: { identifier: string }; diff --git a/src/interfaces/records.ts b/src/interfaces/records.ts index 63422f8..0e253be 100644 --- a/src/interfaces/records.ts +++ b/src/interfaces/records.ts @@ -2,6 +2,7 @@ import { GiveVerifiableCredential, OfferVerifiableCredential } from "./claims"; // a summary record; the VC is found the fullClaim field export interface GiveSummaryRecord { + type?: string; agentDid: string; amount: number; amountConfirmed: number; diff --git a/src/views/ClaimAddRawView.vue b/src/views/ClaimAddRawView.vue index a33caab..f7d36ac 100644 --- a/src/views/ClaimAddRawView.vue +++ b/src/views/ClaimAddRawView.vue @@ -30,7 +30,6 @@