Commit 4a8dcb3
Add isBinary parameter to ws$MessageListener type
Summary:
X-link: react/react-native#55137
Changelog: [Internal] - Add missing isBinary parameter to ws$MessageListener Flow type
The `ws` library's `message` event passes `(data, isBinary)` to callbacks, but the flow-typed definition only included `data`. This caused Flow errors when correctly using `isBinary` to detect binary messages.
This fix adds the missing `isBinary: boolean` parameter to `ws$MessageListener` in both flow-typed locations to keep them synchronized:
- `xplat/js/tools/metro/flow-typed/npm/ws_v7.x.x.js`
- `xplat/js/react-native-github/flow-typed/npm/ws_v7.x.x.js`
This is backwards compatible - existing code that doesn't use `isBinary` will continue to work since for flow a function with fewer parameters is a subtype for callbacks. websocket was always sending both parameters and the javascript just ignored the second one.
https://github.com/websockets/ws/blob/master/doc/ws.md#event-message
Reviewed By: huntie
Differential Revision: D90507002
fbshipit-source-id: 6ab78809213ec167416de35a12cd1fe5c328046f1 parent f9c64be commit 4a8dcb3
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| |||
0 commit comments