Skip to content

Convert codebase to TypeScript with comprehensive type annotations#7

Draft
Copilot wants to merge 11 commits intomasterfrom
copilot/convert-js-files-to-typescript
Draft

Convert codebase to TypeScript with comprehensive type annotations#7
Copilot wants to merge 11 commits intomasterfrom
copilot/convert-js-files-to-typescript

Conversation

Copy link

Copilot AI commented Feb 16, 2026

Migrated 38 JavaScript files to TypeScript across the entire source tree, adding full type safety to components, pages, and utilities.

Type System Additions

  • Generic utilities with proper type inference:
export const Guard = <T>(obj: any, path: string, dval: T): T => { ... }
export const SafeValue = <T>(obj: T | null | undefined, dval: T): T => { ... }
  • Component interfaces for all React components (props, state, event handlers)
  • Data structure types for API responses, player stats, ship data, clan info
  • Shared type exports for cross-module type reuse (e.g., WarshipFilterData)

Files Converted

Core & Components (10 files)

  • src/core/util/SafeGuard.js.ts
  • src/component/common/* (Space, SafeView, PlayerCell, AdmobBanner, Donation)
  • src/component/player/* (DetailedInfo, PlayerRecord)
  • src/component/wiki/WarshipStat.js.tsx

Pages (26 files)

  • Home pages: Setup, Search, RS, Friend, Menu
  • Player pages: Statistics, PlayerShip, Graph, Rank, Detailed
  • Wiki pages: Achievement, CommanderSkill, Warship, WarshipDetail, etc.
  • Settings pages: ProVersion, Settings
  • Common pages: Loading, Filter

Entry points (2 files)

  • src/wowsinfo.js.tsx with App component typing
  • src/page/index.js.tsx barrel exports

Code Quality Fixes

  • Replaced == with === for strict equality (8+ occurrences)
  • Improved global theme typing from any to Theme from react-native-paper
  • Removed unused imports and variables
  • Fixed prettier formatting issues

Compatibility

  • Config files remain .js (eslint, babel, jest, metro)
  • Root index.js unchanged (entry point convention)
  • All exports maintain backward compatibility
  • Zero breaking changes

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 10 commits February 16, 2026 22:46
Co-authored-by: HenryQuan <6754708+HenryQuan@users.noreply.github.com>
Co-authored-by: HenryQuan <6754708+HenryQuan@users.noreply.github.com>
- Converted DetailedInfo.js to DetailedInfo.tsx with proper interfaces for PvpData, WeaponData, and component props/state
- Converted PlayerRecord.js to PlayerRecord.tsx with interfaces for WeaponRecord and PlayerRecordData
- Converted WarshipStat.js to WarshipStat.tsx with interfaces for WarshipProfile and related types
- Converted index.js to index.ts for barrel exports
- Also converted PlayerCell.js to PlayerCell.tsx (already done in previous work)
- Updated InfoLabel.tsx to accept string | number | undefined for the info prop to support various data types
- Added proper type annotations for all function parameters, return types, and event handlers
- Used LayoutChangeEvent type for layout callbacks
- Added null checks and type guards for optional data properties

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove debug console.log statements from DetailedInfo.tsx
- Change loose equality (==) to strict equality (===) in DetailedInfo.tsx
- Change let to const for variables that are not reassigned in PlayerRecord.tsx

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Convert Loading.js to Loading.tsx with proper type annotations
- Convert Filter.js to Filter.tsx with props and state interfaces
- Convert Setup.js to Setup.tsx with typed state and methods
- Convert Search.js to Search.tsx with player/clan item interfaces
- Convert RS.js to RS.tsx with typed props, state and player info
- Convert Friend.js to Friend.tsx with typed friend list data
- Convert Menu.js to Menu.tsx with menu item interfaces
- Add proper return type annotations (JSX.Element, void)
- Add LayoutChangeEvent types for layout handlers
- Add typed event handlers and callbacks
- Fix optional properties in MenuItem interface

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Renamed src/page/index.js to index.tsx (barrel export file)
- Renamed src/wowsinfo.js to wowsinfo.tsx (main app component)
- Added proper TypeScript interfaces for AppProps and AppState
- Typed all function parameters and return types
- Added Theme type from react-native-paper
- Updated global.ts theme types to use 'any' for flexibility
- Added import for './value/global' to access AppGlobalData

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: HenryQuan <6754708+HenryQuan@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI changed the title [WIP] Convert JavaScript files to TypeScript with type annotations Convert codebase to TypeScript with comprehensive type annotations Feb 16, 2026
Copilot AI requested a review from HenryQuan February 16, 2026 23:31
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.

2 participants