Repository navigation
Update TypeScript to latest stable version - #28
Conversation
|
|
5770eca to
f990397
Compare
e310b58 to
49a8d6a
Compare
f990397 to
98dd4b4
Compare
a7ee58b to
1fd23bc
Compare
214c6b9 to
4325f98
Compare
1fd23bc to
c9c08a6
Compare
96f24c9 to
26b3318
Compare
TypeScript has been updated to the latest stable version. Our standard module TypeScript configuration has been brought over from the module template as well, including a separate configuration file for production builds (as opposed to the root file used for things like tests). A `build:clean` has been added as well, for consistency with the module template.
c9c08a6 to
f07e628
Compare
| export function serializeBufferForStorage(buffer: Uint8Array): string { | ||
| let result = '0x'; | ||
| const len = buffer.length || buffer.byteLength; | ||
| for (let i = 0; i < len; i++) { | ||
| result += unprefixedHex(buffer[i]); | ||
| } | ||
| buffer.forEach((value) => { | ||
| result += unprefixedHex(value); | ||
| }); | ||
| return result; | ||
| } |
There was a problem hiding this comment.
This entire function could be replaced with bytesToHex from @metamask/utils.
There was a problem hiding this comment.
Nice! I'm tempted to leave this inline for now until we migrate this into the monorepo, to avoid the dependency bloat problem of having incompatible util library versions (the monorepo basically solves this by making it possible for them to be kept in sync). I'll create an issue for this though, thanks for pointing it out.
There was a problem hiding this comment.
We could make it a peer dependency if you don't want dependency bloat? The version in the extension has the bytes functions already, a lot of functions in this library could be replaced.
There was a problem hiding this comment.
The dependency bloat problem I had in mind was where we need multiple different copies due to major version updates of the utils package, which leaves us with multiple copies unless we're very diligent with updating all packages that use utils (sometimes with can take up to 4 levels of coordinated releases). Adding it as a peer dependency just moves that problem up one level. With the monorepo we are planning on using a Yarn constraint to ensure we have compatible versions across the board.
I've been holding off on replacing internal functions with utils across various different packages for this reason. The monorepo should land tomorrow or Monday though, and I am hoping that migrating a package into it will be a straightforward process. So we may be able to migrate this into the monorepo as early as next week.
TypeScript has been updated to the latest stable version. Our standard module TypeScript configuration has been brought over from the module template as well, including a separate configuration file for production builds (as opposed to the root file used for things like tests).
A
build:cleanhas been added as well, for consistency with the module template.