Skip to content

Comments

chore(js-ts): Convert index.js to TypeScript#307

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1770295159-migrate-index-to-typescript
Open

chore(js-ts): Convert index.js to TypeScript#307
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1770295159-migrate-index-to-typescript

Conversation

@devin-ai-integration
Copy link

@devin-ai-integration devin-ai-integration bot commented Feb 5, 2026

Summary

Migrates the root-level index.js application entry point to TypeScript as part of the ongoing JavaScript to TypeScript migration effort.

Architecture

Due to Metro bundler and CI scripts expecting index.js as the entry file, this PR uses a wrapper pattern:

  • index.js - Thin wrapper that imports from the TypeScript entry point (required for Metro bundler compatibility)
  • app/entry.ts - Contains all the actual application initialization logic in TypeScript

Changes:

  • Created app/entry.ts with all entry point logic converted to TypeScript
  • Simplified index.js to a single import statement
  • Added type declaration for global.ErrorUtils (React Native's global error handler)
  • Updated ESLint disable comments to use TypeScript-specific rules
  • Removed unused ErrorUtils import from react-native (now using typed global.ErrorUtils)
  • Added type cast for handleCustomError to match ErrorHandlerCallback type
  • Updated import paths in app/entry.ts for the new location

Review & Testing Checklist for Human

  • Verify the app starts correctly - This is the application entry point; any issues here will prevent the app from launching
  • Review the handleCustomError as ErrorHandlerCallback type cast (app/entry.ts line 113) - This is a workaround for a pre-existing type mismatch where handleCustomError expects (Error, boolean) but ErrorHandlerCallback expects (any, boolean?). The cast is safe but worth noting.
  • Verify import paths in app/entry.ts are correct (e.g., ../shim.js, ./util/sentry/utils, ../app.config.js)
  • Run the app locally with yarn watch and test basic functionality to ensure error handling still works

Recommended Test Plan

  1. Run yarn watch and verify the app launches without errors
  2. Trigger an error to verify global error handling still works
  3. Verify Sentry integration is functional

Notes

  • CI Status: build, js-bundle-size-check, and all 10 unit-tests shards pass ✅
  • The lint and lint:tsc CI jobs were cancelled but verified locally before pushing
  • Failed CI checks (audit:ci, check-pr-labels, CLABot, sonar-cloud-quality-gate-status) are unrelated to this migration
  • Link to Devin run: https://app.devin.ai/sessions/d07420b7b3674b779d3097f6fbdad30f
  • Requested by: @joao-cognition

Co-Authored-By: Joao Esteves <joao.esteves@cognition.ai>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

…js wrapper

- Moved TypeScript entry point logic from index.ts to app/entry.ts
- Created thin index.js wrapper for Metro bundler compatibility
- Updated import paths in app/entry.ts for new location
- Removed index.ts from tsconfig.json include (app/entry.ts covered by app/**/*)

Co-Authored-By: Joao Esteves <joao.esteves@cognition.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants