You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler's definition of this function requires one or more streams, and differs from MDN and W3C references which specify zero or more.
Code using addTrack(track) without a stream behaved as I expected, matching the docs in Chromium 113.0.5659.0.
I drafted a patch below, but this is untested as I don't have a build process or CLA. (For the avoidance of any doubt, I declare this patch in the public domain)
I was unable to find a way to override this in my project's @externs, the only workaround I came up with is to abandon all checking on this function entirely. I'd be interested if there's a better workaround:
pc['addTrack'](track); /* workaround */
/** @type {!MediaStreamTrack} */
let track;
const pc = new RTCPeerConnection({iceServers: []});
pc.addTrack(track);
$ java -jar closure-compiler-v20230103.jar -O ADVANCED ms.js
ms.js:5:0: WARNING - [JSC_WRONG_ARGUMENT_COUNT] Function RTCPeerConnection.prototype.addTrack: called with 1 argument(s). Function requires at least 2 argument(s).
5| pc.addTrack(track);
^^^^^^^^^^^^^^^^^^
0 error(s), 1 warning(s), 100.0% typed
(new RTCPeerConnection({iceServers:[]})).addTrack(void 0);
The compiler's definition of this function requires one or more streams, and differs from MDN and W3C references which specify zero or more.
Code using
addTrack(track)
without a stream behaved as I expected, matching the docs in Chromium 113.0.5659.0.I drafted a patch below, but this is untested as I don't have a build process or CLA. (For the avoidance of any doubt, I declare this patch in the public domain)
I was unable to find a way to override this in my project's
@externs
, the only workaround I came up with is to abandon all checking on this function entirely. I'd be interested if there's a better workaround:The text was updated successfully, but these errors were encountered: