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.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<div class="w-full">
|
||||
<div class="flex columns-3">
|
||||
<h2 class="text-md font-bold w-full">
|
||||
{{ capitalizeAndInsertSpacesBeforeCaps(veriClaim.claimType) }}
|
||||
{{ capitalizeAndInsertSpacesBeforeCaps(veriClaim.claimType || '') }}
|
||||
<button
|
||||
v-if="
|
||||
['GiveAction', 'Offer', 'PlanAction'].includes(
|
||||
@@ -64,8 +64,9 @@
|
||||
<div data-testId="description">
|
||||
<font-awesome icon="message" class="fa-fw text-slate-400" />
|
||||
{{
|
||||
veriClaim.claim?.itemOffered?.description ||
|
||||
veriClaim.claim?.description
|
||||
(veriClaim.claim?.itemOffered as any)?.description ||
|
||||
(veriClaim.claim as any)?.description ||
|
||||
''
|
||||
}}
|
||||
</div>
|
||||
<div>
|
||||
@@ -77,9 +78,9 @@
|
||||
Recorded
|
||||
{{ veriClaim.issuedAt?.replace(/T/, " ").replace(/Z/, " UTC") }}
|
||||
</div>
|
||||
<div v-if="veriClaim.claim.image" class="flex justify-center">
|
||||
<a :href="veriClaim.claim.image" target="_blank">
|
||||
<img :src="veriClaim.claim.image" class="h-24 rounded-xl" />
|
||||
<div v-if="(veriClaim.claim as any).image" class="flex justify-center">
|
||||
<a :href="(veriClaim.claim as any).image" target="_blank">
|
||||
<img :src="(veriClaim.claim as any).image" class="h-24 rounded-xl" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -507,7 +508,7 @@ import * as R from "ramda";
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Router, RouteLocationNormalizedLoaded } from "vue-router";
|
||||
import { useClipboard } from "@vueuse/core";
|
||||
|
||||
import { GenericVerifiableCredential } from "../interfaces";
|
||||
import GiftedDialog from "../components/GiftedDialog.vue";
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
@@ -542,8 +543,8 @@ export default class ClaimView extends Vue {
|
||||
confirmerIdList: string[] = []; // list of DIDs that have confirmed this claim excluding the issuer
|
||||
confsVisibleErrorMessage = "";
|
||||
confsVisibleToIdList: string[] = []; // list of DIDs that can see any confirmer
|
||||
detailsForGive = null;
|
||||
detailsForOffer = null;
|
||||
detailsForGive: { fulfillsPlanHandleId?: string; fulfillsType?: string; fulfillsHandleId?: string } | null = null;
|
||||
detailsForOffer: { fulfillsPlanHandleId?: string } | null = null;
|
||||
fullClaim = null;
|
||||
fullClaimDump = "";
|
||||
fullClaimMessage = "";
|
||||
@@ -556,7 +557,7 @@ export default class ClaimView extends Vue {
|
||||
showVeriClaimDump = false;
|
||||
veriClaim = serverUtil.BLANK_GENERIC_SERVER_RECORD;
|
||||
veriClaimDump = "";
|
||||
veriClaimDidsVisible = {};
|
||||
veriClaimDidsVisible: { [key: string]: string[] } = {};
|
||||
windowLocation = window.location.href;
|
||||
|
||||
R = R;
|
||||
@@ -877,7 +878,7 @@ export default class ClaimView extends Vue {
|
||||
),
|
||||
),
|
||||
);
|
||||
const confirmationClaim: serverUtil.GenericVerifiableCredential = {
|
||||
const confirmationClaim: GenericVerifiableCredential = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "AgreeAction",
|
||||
object: goodClaim,
|
||||
|
||||
Reference in New Issue
Block a user