fix(types): resolve CI TypeScript errors for issue #24#40
fix(types): resolve CI TypeScript errors for issue #24#40Ebenezer199914 wants to merge 2 commits into
Conversation
…em products - Add interview templates for Freelii, Gearup, Reyts, Juntta, Skyhitz - Fix TS error: export Dispute type from blockchain/types.ts - Fix TS error: add useSubmitEvidence to BlockchainHooks interface - Fix TS error: explicit type annotation on DisputeCard voters.find callback Closes sliceprotocol#24
- Export Dispute interface from src/blockchain/types.ts (used by hooks.ts and useDisputeParties.ts) - Add useSubmitEvidence optional method to BlockchainHooks interface (used by mock.tsx and hooks.ts proxy) - Type voters.find() callback parameter in DisputeCard.tsx to fix implicit 'any' error Resolves 5 TypeScript errors (TS2305 x2, TS2339 x1, TS2353 x1, TS7006 x1) Closes sliceprotocol#24
📝 WalkthroughWalkthroughAdds five structured interview research documents for Stellar ecosystem products (Freelii, Gearup, Juntta, Reyts, Skyhitz) under ChangesCustomer Discovery Research Docs
Dispute Type System and Evidence Hook
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/blockchain/types.tsOops! Something went wrong! :( ESLint: 9.39.2 TypeError: Converting circular structure to JSON ... [truncated 453 characters] ... c/dist/eslintrc.cjs:3261:25) src/components/disputes/DisputeCard.tsxOops! Something went wrong! :( ESLint: 9.39.2 TypeError: Converting circular structure to JSON ... [truncated 453 characters] ... c/dist/eslintrc.cjs:3261:25) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/research/interviews/Skyhitz.md (1)
4-4: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueInconsistent SCF profile format.
All other interview files use
https://communityfund.stellar.org/projectsfor the Perfil SCF field, but Skyhitz usesDiscord / X. If Skyhitz doesn't have an SCF profile page, consider usingN/Aor a direct SCF link if one exists, to maintain template consistency.- **Perfil SCF**: Discord / X + **Perfil SCF**: https://communityfund.stellar.org/projectsOr if intentionally absent:
- **Perfil SCF**: Discord / X + **Perfil SCF**: N/A — contact via Discord / X🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/research/interviews/Skyhitz.md` at line 4, The Perfil SCF value in Skyhitz is inconsistent with the interview template used elsewhere. Update the `Perfil SCF` entry in this markdown file to match the standard SCF project URL format used by the other interview documents, or use `N/A` if no SCF profile exists; if there is a real SCF page for Skyhitz, prefer that instead of the current Discord / X text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/blockchain/types.ts`:
- Around line 72-103: The frontend dispute model is being duplicated by
introducing a separate Dispute shape, which conflicts with the shared-type
contract. Move the frontend-specific fields into the existing DisputeUI contract
and make DisputeCard and any other consumers import and use DisputeUI directly
instead of recreating `Dispute & { ... }` locally. Keep the dispute
representation centralized in the shared type definition so the UI
evidence/rendering fields stay consistent across files.
---
Nitpick comments:
In `@docs/research/interviews/Skyhitz.md`:
- Line 4: The Perfil SCF value in Skyhitz is inconsistent with the interview
template used elsewhere. Update the `Perfil SCF` entry in this markdown file to
match the standard SCF project URL format used by the other interview documents,
or use `N/A` if no SCF profile exists; if there is a real SCF page for Skyhitz,
prefer that instead of the current Discord / X text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e2e61c68-338c-467c-a73f-54c89d7b0791
📒 Files selected for processing (7)
docs/research/interviews/Freelii.mddocs/research/interviews/Gearup.mddocs/research/interviews/Juntta.mddocs/research/interviews/Reyts.mddocs/research/interviews/Skyhitz.mdsrc/blockchain/types.tssrc/components/disputes/DisputeCard.tsx
| /** | ||
| * Full dispute representation used by the frontend | ||
| */ | ||
| export interface Dispute { | ||
| id: string | bigint; | ||
| title: string; | ||
| description?: string; | ||
| category: string; | ||
| status: number | string; | ||
| phase?: string; | ||
| deadlineLabel?: string; | ||
| isUrgent?: boolean; | ||
| stake?: string; | ||
| claimer: string; | ||
| defender: string; | ||
| claimerName?: string; | ||
| defenderName?: string; | ||
| claimerDescription?: string; | ||
| defenderDescription?: string; | ||
| claimerCarouselEvidence?: string[]; | ||
| defenderCarouselEvidence?: string[]; | ||
| claimerAudioEvidence?: string; | ||
| defenderAudioEvidence?: string; | ||
| evidence?: string[]; | ||
| jurorsRequired?: number; | ||
| votesCount?: number; | ||
| revealDeadline?: number; | ||
| evidenceDeadline?: number; | ||
| claimerPaid?: boolean; | ||
| defenderPaid?: boolean; | ||
| ruling?: number; | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Keep a single shared DisputeUI contract for frontend disputes.
This introduces a second canonical frontend shape named Dispute, while src/components/disputes/DisputeCard.tsx still builds its UI model as type DisputeUI = Dispute & { ... }. That violates the shared-type rule and makes the evidence/rendering contract easy to drift across files.
♻️ Proposed fix
-export interface Dispute {
+export interface DisputeUI {
id: string | bigint;
title: string;
description?: string;
category: string;
status: number | string;
phase?: string;
deadlineLabel?: string;
isUrgent?: boolean;
stake?: string;
claimer: string;
defender: string;
claimerName?: string;
defenderName?: string;
claimerDescription?: string;
defenderDescription?: string;
claimerCarouselEvidence?: string[];
defenderCarouselEvidence?: string[];
claimerAudioEvidence?: string;
defenderAudioEvidence?: string;
evidence?: string[];
jurorsRequired?: number;
votesCount?: number;
revealDeadline?: number;
evidenceDeadline?: number;
claimerPaid?: boolean;
defenderPaid?: boolean;
ruling?: number;
}Then import and use DisputeUI directly in consumers instead of recreating it locally.
As per coding guidelines, "Use DisputeUI interface for all frontend dispute representations."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/blockchain/types.ts` around lines 72 - 103, The frontend dispute model is
being duplicated by introducing a separate Dispute shape, which conflicts with
the shared-type contract. Move the frontend-specific fields into the existing
DisputeUI contract and make DisputeCard and any other consumers import and use
DisputeUI directly instead of recreating `Dispute & { ... }` locally. Keep the
dispute representation centralized in the shared type definition so the UI
evidence/rendering fields stay consistent across files.
Source: Coding guidelines
📝 Summary
Fixes 5 TypeScript errors that were blocking CI on the
feat/customer-discovery-b2b-stellar-productsbranch.🔗 Related Issues
Closes #24
🔄 Changes Made
Three targeted type fixes to resolve all CI errors:
src/blockchain/types.ts— Exported theDisputeinterface (was defined internally but not exported), sohooks.tsanduseDisputeParties.tscan import it.src/blockchain/types.ts— Added optionaluseSubmitEvidencemethod to theBlockchainHooksinterface, matching the implementation already present inmock.tsxandhooks.ts.src/components/disputes/DisputeCard.tsx— Typed thevoters.find()callback parameter to fix implicitanyerror.🧪 Testing
✅ Testing Checklist
tscpasses with 0 errors (was 5 errors)None — changes are additive type-only fixes with no runtime impact.
🚀 Next Steps & Improvements
Summary by CodeRabbit
New Features
Bug Fixes
Documentation