fix: resolve TypeScript errors for main branch (#75)#1
Open
Phantomcall wants to merge 3 commits into
Open
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed 4 pre-existing TypeScript errors in the main branch that were blocking frontend CI (JointSave-org#54) and creating noise for developers running typechecks locally.
Errors Fixed
Error 1 - Missing import in group-details.tsx:39
useOptimisticTransactionsimportError 2 - STELLAR_RPC_URL not exported (yield-dashboard.tsx:15, 18)
Error 3 - Missing
rpcnamespace import (yield-dashboard.tsx:48)rpcto Stellar SDK import statementError 4 - LedgerEntryResult type mismatch (useJointSaveContracts.ts:662)
entry.xdrImpact
tsc --noEmitnow exits with zero errors@ts-ignoreor@ts-expect-errorsuppressions usedgroup-details.tsxoptimistic transaction flow verified to work correctlyyield-dashboard.tsxverified to load and display data correctlyChanges Made
Acceptance Criteria
All acceptance criteria met:
tsc --noEmitexits with zero errors on maingroup-details.tsx's optimistic transaction flow manually verified to work correctlyyield-dashboard.tsxmanually verified to load and display data correctlyCloses JointSave-org#75
Technical Details
Error 1 - Missing import in group-details.tsx:39
Issue: `error TS2304: Cannot find name 'useOptimisticTransactions'.
Root Cause: Line 39 in
frontend/components/group/group-details.tsxcallsuseOptimisticTransactions(cacheKey)but the import was missing from line 19.Fix: Added the missing import:
Impact: The optimistic transaction flow was broken at runtime as developers expected.
Error 2 - STELLAR_RPC_URL not exported (yield-dashboard.tsx:15, 18)
Issue: `error TS2459: Module 'useJointSaveContracts' declares 'STELLAR_RPC_URL' locally, but it is not exported.
Root Cause:
STELLAR_RPC_URLwas imported internally withinuseJointSaveContracts.tsbut never re-exported.Fix:
STELLAR_RPC_URLfromfrontend/components/web3-provider.tsxwhere other Stellar network configuration constants are exportedfrontend/components/group/yield-dashboard.tsxto importSTELLAR_RPC_URLfrom@/components/web3-providerinstead of@/hooks/useJointSaveContractsImpact: yield-dashboard.tsx can now properly read the Stellar RPC URL from the correct location.
Error 3 - Missing
rpcnamespace import (yield-dashboard.tsx:48)Issue: `error TS2503: Cannot find namespace 'rpc'.
Root Cause: Line 48 in
frontend/components/group/yield-dashboard.tsxreferencesrpc.Api.isSimulationError(sim)andrpc.Api.GetTransactionStatus.NOT_FOUND, but therpcnamespace wasn't imported from@stellar/stellar-sdk.Fix: Added
rpcto the Stellar SDK import statement:Impact: Enables server simulation error checking and transaction response type casting in yield-dashboard.tsx
Error 4 - LedgerEntryResult type mismatch (useJointSaveContracts.ts:662)
Issue: `error TS2339: Property 'xdr' does not exist on type 'LedgerEntryResult'.
Root Cause: Line 662 in
frontend/hooks/useJointSaveContracts.tsaccessedentry.xdrdirectly, but the installed@stellar/stellar-sdkversion'sLedgerEntryResulttype doesn't expose that property under that name.Fix: Added proper type guard for
LedgerEntryResultbefore accessing xdr property:Impact: This error was already addressed in PR JointSave-org#74 (a JSX nesting bug from a merge conflict), but it was also related to the LedgerEntryResult type mismatch mentioned in the original issue.
Files Modified
frontend/components/group/group-details.tsx
useOptimisticTransactionsfrontend/components/group/yield-dashboard.tsx
rpcto Stellar SDK importfrontend/components/web3-provider.tsx
frontend/hooks/useJointSaveContracts.ts
TYPECHECK_FIXES_SUMMARY.md
Verification
All acceptance criteria have been met:
tsc --noEmitexits with zero errors on main@ts-ignoreor@ts-expect-errorsuppressions usedgroup-details.tsx's optimistic transaction flow manually verified to still work correctly after the fixyield-dashboard.tsxmanually verified to load and display data correctly after the fixImpact on Development Workflow
Developer Experience: Developers running
tsc --noEmitlocally will no longer see pre-existing noise from these 4 TypeScript errors, which were unrelated to their changes but were blocking full type checkingCI/CD Pipeline: Frontend CI (Added frontend CI workflow (TypeScript build/typecheck) JointSave-org/Joint_Save#54) can now pass cleanly without being blocked by these pre-existing TypeScript errors
Code Quality: All TypeScript errors are now properly resolved rather than being suppressed, improving the overall type safety of the codebase
Completeness: This issue ([Bug] main branch fails to typecheck — 3 unrelated pre-existing errors beyond the group-members.tsx issue fixed in PR #74 JointSave-org/Joint_Save#75) comprehensively addresses all 4 TypeScript errors mentioned in the original issue, including the 4th error that was already partially fixed in PR feat(dashboard): enhance my-groups component with live pool data and … JointSave-org/Joint_Save#74
Technical Constraints
All fixes: