refactor: convert app/scripts/lib/stream-utils.js to TypeScript#41475
refactor: convert app/scripts/lib/stream-utils.js to TypeScript#41475DDDDDanica merged 3 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/MetaMask/metamask-extension/sessions/1ee260cc-9527-4f4a-87a5-ce330f06c33c Co-authored-by: DDDDDanica <12678455+DDDDDanica@users.noreply.github.com>
Builds ready [b438d0c]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
Co-authored-by: Jongsun Suh <jongsun.suh@icloud.com>
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
Builds ready [0c2a1f1]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|



[skip-e2e]
Converts
app/scripts/lib/stream-utils.jsto TypeScript as part of the ongoing TS migration effort, and removes its entry fromfiles-to-convert.json.Changes
stream-utils.ts— renamed from.jswith the following type additions:StreamLiketype capturing the internal stream properties accessed byisStreamWritableacross implementations (node:stream, readable-stream v2/v3/v4,@metamask/object-multiplex)setupMultiplex: parameter typed asDuplex, return typed asObjectMultiplexisStreamWritable: parameter typed asStreamLike, return typed asboolean; pipeline error callback typed asError | nullpipelineimport uses// @ts-expect-error(consistent withprovider-stream.ts,phishing-stream.ts,cookie-handler-stream.ts)/** */docblock insideisStreamWritableconverted to/* */to satisfyjsdoc/check-indentationfiles-to-convert.json— removed"app/scripts/lib/stream-utils.js"entryNote
Low Risk
Low risk TS migration change that primarily adds typings and adjusts imports/comments; runtime behavior should be unchanged aside from slightly stricter stream type expectations at compile time.
Overview
Converts
app/scripts/lib/stream-utilsfrom JS to TS, adding explicit types forsetupMultiplex(nowDuplex->ObjectMultiplex) andisStreamWritable(now accepts aStreamLikeshape used across multiple stream implementations).Adjusts the
readable-streamimport to includeDuplexwith a@ts-expect-errorand tightens thepipelineerror callback type, and removesstream-utils.jsfrom the TS migration dashboard list.Reviewed by Cursor Bugbot for commit 0c2a1f1. Bugbot is set up for automated code reviews on this repo. Configure here.