[DevTools] Improve type coverage for extension runtime API#655
[DevTools] Improve type coverage for extension runtime API#655everettbu wants to merge 2 commits into
Conversation
Greptile SummaryReplaces the untyped
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: 3c1d4f2 |
| } | ||
|
|
||
| function registerProxyPort(port, tabId) { | ||
| function registerProxyPort(port: ExtensionRuntimePort, tabId: string) { |
There was a problem hiding this comment.
Inconsistent tabId parameter type
registerExtensionPort declares tabId: number (line 44), but registerProxyPort declares tabId: string. Both functions are called with a numeric tabId derived from port.sender.tab.id (a number), and the call on line 95-99 already requires a $FlowFixMe[incompatible-call] to suppress the mismatch. For consistency, this should also be tabId: number.
| function registerProxyPort(port: ExtensionRuntimePort, tabId: string) { | |
| function registerProxyPort(port: ExtensionRuntimePort, tabId: number) { |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-devtools-extensions/src/background/index.js
Line: 58
Comment:
**Inconsistent `tabId` parameter type**
`registerExtensionPort` declares `tabId: number` (line 44), but `registerProxyPort` declares `tabId: string`. Both functions are called with a numeric `tabId` derived from `port.sender.tab.id` (a `number`), and the call on line 95-99 already requires a `$FlowFixMe[incompatible-call]` to suppress the mismatch. For consistency, this should also be `tabId: number`.
```suggestion
function registerProxyPort(port: ExtensionRuntimePort, tabId: number) {
```
How can I resolve this? If you propose a fix, please make it concise.|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35957
Original author: eps1lon
Adds types for
chrome.runtime.*andchrome.tabs.*. Types are based of off the version that's shared across browsers. We'll see if we need different versions for chrome and firefox.devtools.panels,storage,permissions, andscriptingare still typed asany. Main interest wasruntimeandtabsto investigate react/react#35954