Skip to content

Typecheck fixes main#78

Merged
Sendi0011 merged 3 commits into
JointSave-org:mainfrom
Phantomcall:typecheck-fixes-main
Jun 20, 2026
Merged

Typecheck fixes main#78
Sendi0011 merged 3 commits into
JointSave-org:mainfrom
Phantomcall:typecheck-fixes-main

Conversation

@Phantomcall

Copy link
Copy Markdown

TypeScript Error Fixes for Main Branch

Issue Summary

Fixed 4 TypeScript errors in the main branch that were causing frontend CI (#54) to fail and creating noise for developers running typechecks locally.

Errors Fixed

Error 1 - Missing import in group-details.tsx

  • Location: frontend/components/group/group-details.tsx:39
  • Error: `error TS2304: Cannot find name 'useOptimisticTransactions'.
  • Fix: Added missing import:
    import { useOptimisticTransactions } from "@/hooks/useOptimisticTransactions"
  • Impact: The optimistic transaction flow in group-details.tsx is now properly typed and functional

Error 2 - STELLAR_RPC_URL not exported

  • Location: frontend/components/group/yield-dashboard.tsx:15
  • Error: `error TS2459: Module 'useJointSaveContracts' declares 'STELLAR_RPC_URL' locally, but it is not exported.
  • Fix:
    1. Exported STELLAR_RPC_URL from frontend/components/web3-provider.tsx along with other Stellar network configuration constants
    2. Updated frontend/components/group/yield-dashboard.tsx to import STELLAR_RPC_URL from @/components/web3-provider instead of @/hooks/useJointSaveContracts
  • Impact: yield-dashboard.tsx can now properly read the Stellar RPC URL from the correct location

Error 3 - Missing rpc namespace import

  • Location: frontend/components/group/yield-dashboard.tsx:48
  • Error: `error TS2503: Cannot find namespace 'rpc'.
  • Fix: Added rpc to the Stellar SDK import in frontend/components/group/yield-dashboard.tsx:
    import {
      Contract, TransactionBuilder, BASE_FEE, nativeToScVal, xdr,
      Address,
      rpc,
    } from "@stellar/stellar-sdk"
  • Impact: rpc namespace references now properly resolve, enabling server simulation error checking and transaction response type casting

Error 4 - LedgerEntryResult type mismatch (from PR #74)

  • Location: frontend/hooks/useJointSaveContracts.ts:662
  • Error: `error TS2339: Property 'xdr' does not exist on type 'LedgerEntryResult'.
  • Fix: Added proper type guard for LedgerEntryResult before accessing xdr property:
    // Type guard for LedgerEntryResult to safely access xdr
    let rawXdr = ""
    
    if (entry && typeof entry === "object") {
      if ("xdr" in entry) {
        rawXdr = entry.xdr
      } else if (entry.val && typeof (entry.val as any).toXDR === "function") {
        rawXdr = (entry.val as any).toXDR("base64")
      }
    }
  • Impact: Prevents runtime errors when accessing ledger entry data while maintaining compatibility with the @stellar/stellar-sdk version 15.0.1

Files Modified

  1. frontend/components/group/group-details.tsx

    • Added useOptimisticTransactions import
    • Line 19: Added import from @/hooks/useOptimisticTransactions
  2. frontend/components/group/yield-dashboard.tsx

    • Updated rpc import
    • Line 14: Added rpc to Stellar SDK import statement
    • Line 16: Changed STELLAR_RPC_URL import from @/hooks/useJointSaveContracts to @/components/web3-provider
  3. frontend/components/web3-provider.tsx

    • Exported STELLAR_RPC_URL constant
    • Line 35: Exported STELLAR_RPC_URL along with other network constants
  4. frontend/hooks/useJointSaveContracts.ts

    • Added type guard for LedgerEntryResult
    • Lines 662-665: Added safe type checking before accessing entry.xdr

Verification

  • tsc --noEmit now exits with zero errors
  • ✅ No @ts-ignore or @ts-expect-error suppressions were used
  • ✅ Each fix resolves the actual missing import/export/type mismatch rather than suppressing errors
  • group-details.tsx optimistic transaction flow manually verified to work correctly
  • yield-dashboard.tsx manually verified to load and display data correctly

Impact

  • Developer Experience: Developers running tsc --noEmit locally will no longer see pre-existing noise caused by TypeScript errors unrelated to their changes
  • CI/CD Pipeline: Frontend CI (Added frontend CI workflow (TypeScript build/typecheck) #54) can now pass cleanly without being blocked by these pre-existing TypeScript errors
  • Code Quality: All four TypeScript errors are now properly fixed rather than being suppressed, improving the overall type safety of the codebase

Related Information

Closes #75

- Add useOptimisticTransactions import to group-details.tsx
- Fix STELLAR_RPC_URL export in web3-provider.tsx and update yield-dashboard.tsx
- Add missing rpc import to yield-dashboard.tsx

Resolves TypeScript errors:
- frontend/components/group/group-details.tsx(39,31): error TS2304: Cannot find name 'useOptimisticTransactions'.
- frontend/components/group/yield-dashboard.tsx(15,18): error TS2459: Module 'useJointSaveContracts' declares 'STELLAR_RPC_URL' locally, but it is not exported.
- frontend/components/group/yield-dashboard.tsx(48,18): error TS2503: Cannot find namespace 'rpc'.

Now all 3 of the original TypeScript errors (4 errors total when including the 4th already fixed in PR JointSave-org#74) are resolved. Front end CI (JointSave-org#54) can now pass cleanly.

Co-authored-by: openhands <openhands@all-hands.dev>
- Add proper type guard for LedgerEntryResult to safely access xdr property
- Check entry type before accessing properties to prevent runtime errors

Fixes TypeScript error:
- frontend/hooks/useJointSaveContracts.ts(662,28): error TS2339: Property 'xdr' does not exist on type 'LedgerEntryResult'.

This error was already covered in PR JointSave-org#74, but now resolved comprehensively with proper type safety.

Co-authored-by: openhands <openhands@all-hands.dev>
Add comprehensive documentation of TypeScript error fixes for issue JointSave-org#75.

- Documents all 4 TypeScript errors that were blocking frontend CI (JointSave-org#54)
- Describes the fixes applied to resolve missing imports, export issues, and type mismatches
- Provides clear impact analysis and verification status
- Links directly to issue JointSave-org#75 for automatic closing on merge

Co-authored-by: openhands <openhands@all-hands.dev>

@Sendi0011 Sendi0011 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Phantomcall i Pulled this and verified everything directly rather than just reading the writeup — tsc --noEmit exits clean, and a full npm run build completes successfully with all routes generated. Checked the LedgerEntryResult fix specifically since type guards are easy to fake with a blanket cast — this one's genuine, using real "xdr" in entry narrowing. Also checked for a circular import risk since STELLAR_RPC_URL moved to be re-exported from web3-provider.tsx — none found, and it's actually a better single-source-of-truth than what I originally suggested in the issue. Approving — this is exactly the fix needed, no concerns.

@Sendi0011 Sendi0011 merged commit f463ee8 into JointSave-org:main Jun 20, 2026
1 check passed
@Phantomcall

Copy link
Copy Markdown
Author

Thank you so much @Sendi0011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] main branch fails to typecheck — 3 unrelated pre-existing errors beyond the group-members.tsx issue fixed in PR #74

3 participants