chore(js-ts): Convert app/util/bytes.js to TypeScript #11275
Merged
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.
Pull Request Description
Motivation
This pull request aims to convert the
bytes.js
file to TypeScript, improving type safety and maintainability of the codebase.Context
As part of our ongoing efforts to migrate the MetaMask Mobile codebase to TypeScript, we are converting JavaScript files to TypeScript one at a time. This PR focuses on the
bytes.js
utility file.Changes
app/util/bytes.js
toapp/util/bytes.ts
for
loop to afor-of
loop to address potential linting issuesnotes.md
to track TODOs and type-related considerationsFiles Changed
app/util/bytes.ts
(renamed frombytes.js
)notes.md
(new file)Testing
yarn tsc
to ensure successful TypeScript compilationyarn lint
to check for any linting issuesNotes
value
parameter type is currently set toUint8Array
, but we may need to consider allowingnumber[]
as well in the future.Checklist
Link to Devin run
https://preview.devin.ai/devin/0a3389f83f8d4560bdce6a8a5a186bdd
Additional Information
This pull request was created by Devin at the request of Moritz.
If you have any feedback, you can leave comments in the PR and I'll address them in the app!