chore(js-ts): migrate foundational JS files to TypeScript#323
Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Open
chore(js-ts): migrate foundational JS files to TypeScript#323devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Conversation
Migrate constants, mocks, and image-icons files from .js to .ts with proper type annotations: Constants: - app/constants/navigation.js -> .ts - app/constants/network.js -> .ts - app/constants/onboarding.js -> .ts Mocks: - app/__mocks__/pngMock.js -> .ts - app/__mocks__/react-native-device-info.js -> .ts - app/__mocks__/react-native-splash-screen.js -> .ts - app/__mocks__/react-native-view-shot.js -> .ts - app/__mocks__/rn-fetch-blob.js -> .ts - app/__mocks__/svgMock.js -> .ts Images: - app/images/image-icons.js -> .ts Co-Authored-By: Joao Esteves <joao.esteves@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Joao Esteves <joao.esteves@cognition.ai>
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.
chore(js-ts): migrate foundational JS files to TypeScript
Summary
Converts 10 foundational
.jsfiles (constants, mocks, image-icons) to.tsas part of the ongoing JS-to-TS migration. Type annotations added to all exports.Constants (3 files):
app/constants/navigation.js→.tsapp/constants/network.js→.tsapp/constants/onboarding.js→.tsMocks (6 files):
app/__mocks__/pngMock.js→.tsapp/__mocks__/react-native-device-info.js→.tsapp/__mocks__/react-native-splash-screen.js→.tsapp/__mocks__/react-native-view-shot.js→.tsapp/__mocks__/rn-fetch-blob.js→.tsapp/__mocks__/svgMock.js→.tsImages (1 file):
app/images/image-icons.js→.tsAlso updates
jest.config.jsmoduleNameMapperpaths from.jsto.tsforsvgMockandpngMockto match the renamed files.No new dependencies added.
yarn lintpasses with 0 errors locally.yarn lint:tscshows only pre-existing errors in unrelated files (first-party-contracts.ts,ppom-util.test.ts, etc.).Updates since last revision
svgMock.js→.tsandpngMock.js→.tsbroke Jest'smoduleNameMapperinjest.config.js, which had hardcoded.jspaths. Updated both entries to.ts. All 10 unit test shards now pass in CI.scripts (lint)andscripts (lint:tsc)checks were cancelled in CI (not failed) due to the pre-existingaudit:cifailure in the same workflow group. Both pass locally with 0 new errors.Review & Testing Checklist for Human
PREVIOUS_SCREEN: string,MAINNET: string) and objects (NETWORKS_CHAIN_ID: Record<string, string>) use widened types instead of narrow literal inference. If any downstream code relies on literal types (e.g.,typeof MAINNETbeing'mainnet'rather thanstring, or specific key names onNETWORKS_CHAIN_ID), this could cause type errors not caught bylint:tsc. Consider whetheras const+ derived types would be safer.yarn test) to confirm Jest mock resolution. Thejest.config.jsfix was verified locally and unit tests pass in CI, but confirm that mock files likereact-native-splash-screen.tsandrn-fetch-blob.tsare still picked up correctly in all test contexts.image-icons.tsexport change. The export pattern changed from inlineexport default { ... }to a named const (imageIcons: Record<string, ImageSourcePropType>) +export default imageIcons. This is functionally equivalent but worth a quick sanity check that image imports work at runtime.lintandlint:tscpass in CI. These checks were cancelled (not failed) in the current CI run due to an unrelatedaudit:cifailure. Re-running CI or merging to trigger a fresh run would confirm they pass.Notes
: stringannotations on string literal constants widen what TypeScript would otherwise infer as narrow literal types. This is a stylistic choice — it's consistent across the PR but trades type precision for explicitness.lint:tscerrors infirst-party-contracts.tsare related to0x${string}template literal mismatches withRecord<string, string>— the same pattern used in this PR'snetwork.ts. Worth keeping in mind if tightening types later.Link to Devin run: https://app.devin.ai/sessions/bab011b6f02f48faa4215079668ee9e5
Requested by: @joao-cognition