Skip to content

Commit 9b90174

Browse files
authored
fix: update addIceCandidate arguments
The TypeScript types for `RTCPeerConnection.addIceCandidate` says it accepts `RTCIceCandidateInit | null | undefined`, not `RTCIceCandidateInit | RTCIceCandidate | undefined` so accept those types, otherwise the polyfill does not have type overlap with the browser version and `tsc` fails to compile. See: https://github.com/microsoft/TypeScript/blob/700ee076e515db2ef49d8cf7e4dc4bf70679575c/src/lib/dom.generated.d.ts#L18714
1 parent b0caa62 commit 9b90174

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/polyfill/RTCPeerConnection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export default class RTCPeerConnection extends EventTarget implements globalThis
282282
return this.#peerConnection.signalingState();
283283
}
284284

285-
async addIceCandidate(candidate?: globalThis.RTCIceCandidateInit | RTCIceCandidate): Promise<void> {
285+
async addIceCandidate(candidate?: globalThis.RTCIceCandidateInit | null): Promise<void> {
286286
if (!candidate || !candidate.candidate) {
287287
return;
288288
}

0 commit comments

Comments
 (0)