Skip to content

chore(frontend): enable noUncheckedIndexedAccess and noUnusedLocals#732

Open
shogun444 wants to merge 1 commit into
LabsCrypt:mainfrom
shogun444:feat/frontend-strict-types
Open

chore(frontend): enable noUncheckedIndexedAccess and noUnusedLocals#732
shogun444 wants to merge 1 commit into
LabsCrypt:mainfrom
shogun444:feat/frontend-strict-types

Conversation

@shogun444
Copy link
Copy Markdown

Closes #650

Summary

Enabled noUncheckedIndexedAccess and noUnusedLocals in the frontend TypeScript configuration and resolved all resulting compiler issues across the codebase.

This change improves type safety by making potentially undefined index access explicit and removes unused imports/locals surfaced by stricter compiler checks. No user-facing behavior or APIs were changed.

Changes

TypeScript Configuration

Updated frontend/tsconfig.json:

  • Enabled noUncheckedIndexedAccess
  • Enabled noUnusedLocals

Type Safety Improvements

Resolved unchecked index access warnings by adding appropriate guards and fallbacks:

  • Added safe handling for array/object lookups that may return undefined
  • Added fallbacks for string split index access
  • Guarded optional DOM element references before invoking methods
  • Added checks for potentially undefined collection items before use

Examples include:

  • dashboard-view.tsx
  • useModalDialog.ts
  • amount.ts
  • dashboard.ts
  • csvExport.ts
  • soroban.ts

Cleanup

Removed unused imports and local variables surfaced by noUnusedLocals, including unused React imports and other dead code throughout the frontend.

Validation

Successfully verified the changes with:

npx tsc --noEmit
npm run build
npm run test

Results

  • noUncheckedIndexedAccess enabled
  • noUnusedLocals enabled
  • Frontend builds successfully
  • All tests passing (101 tests)
  • No API or behavior changes
  • Improved type safety and maintainability

Copy link
Copy Markdown
Contributor

@ogazboiz ogazboiz left a comment

Choose a reason for hiding this comment

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

clean — closes #650 (frontend tsconfig now enforces noUncheckedIndexedAccess and noUnusedLocals across 22 files). all CI green. merging!

join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0

@ogazboiz
Copy link
Copy Markdown
Contributor

ogazboiz commented Jun 2, 2026

approved! but a couple of conflicting merges landed first and now this branch is DIRTY. quick rebase and it can land:

git fetch upstream
git rebase upstream/main
git push --force-with-lease

i'll auto-merge as soon as it's clean.

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.

[Frontend] tsconfig.json — enable noUncheckedIndexedAccess and noUnusedLocals

2 participants