Skip to content

chore(js-ts): Convert utility files to TypeScript (9 files)#615

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1777472826-js-ts-utility-functions
Open

chore(js-ts): Convert utility files to TypeScript (9 files)#615
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1777472826-js-ts-utility-functions

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 29, 2026

Summary

Converts 9 utility files from JavaScript to TypeScript as part of the ongoing JS→TS migration (Playbook 6 — Utility Functions).

Batch 1 (5 files):

  • app/util/walletconnect.js.ts — pure exports, type inference sufficient
  • app/util/payment-link-generator.js.ts — add string parameter/return types
  • app/util/device/index.js.ts — Device class, add async return type
  • app/util/confirm-tx.js.ts — add types to all gas/currency helper functions
  • app/util/ENSUtils.js.ts — add types, replace this.ens with module-level variable, add CacheEntry interface

Batch 2 (4 files):

  • app/util/gasUtils.js.ts — pure BigNumber constants, type inference sufficient
  • app/util/general/index.js.ts — add types to all general utility functions, define NavigationRoute interface
  • app/util/custom-gas/index.js.ts — add types to gas calculation functions
  • app/util/conversions.js.ts — add types to all hex/wei/gwei conversion functions, fix .js import extension

No logic changes — types only.

Review & Testing Checklist for Human

  • Verify ENSUtils.ts change from this.ens to module-level ensInstance variable preserves the same runtime behavior (the original used this in free functions which would have been the module scope)
  • Verify general/index.ts timeoutFetch Promise.race return type is compatible with callers
  • Spot-check that parameter types match actual usage (especially confirm-tx.ts where some params could be number | string)

Notes

  • walletconnect.ts and gasUtils.ts needed zero changes — TypeScript infers their types correctly from the literal/constructor values
  • The ENSUtils.ts change from this.ens to a module-level variable is a minor structural improvement — the original code used this in exported free functions which referred to the module object at runtime

Link to Devin session: https://app.devin.ai/sessions/51734166b8b740daa75579e47f5a94be
Requested by: @lukepage-COG


Devin Review

Status Commit
⚪ Not started

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

devin-ai-integration Bot and others added 2 commits April 29, 2026 14:29
- walletconnect.js → .ts (pure exports, no changes needed)
- payment-link-generator.js → .ts (add parameter/return types)
- device/index.js → .ts (Device class, add async return type)
- confirm-tx.js → .ts (add types to all gas/currency functions)
- ENSUtils.js → .ts (add types, replace this.ens with module-level var)
- No logic changes - types only

Co-Authored-By: Luke Page <luke.page@cognition.ai>
- gasUtils.js → .ts (pure constants, no changes needed)
- general/index.js → .ts (add types to all utility functions)
- custom-gas/index.js → .ts (add types to gas calculation functions)
- conversions.js → .ts (add types to all conversion functions)
- Fix import path: confirm-tx.js → confirm-tx (extensionless)
- No logic changes - types only

Co-Authored-By: Luke Page <luke.page@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
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

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