'setCodecPreferences' function 'RTCRtpTransceiver' is removed in TypeScript Version 4.5.5

Viewed 108

The following code was compiling successfully on TypeScript version 3.5.0

private SetCodecPreferences (transceiver: RTCRtpTransceiver):
void
{
    transceiver.setCodecPreferences(PREFERRED_VIDEO_CODECS); //PREFERRED_VIDEO_CODECS is of type RTCRtpCodecCapability[]
} 

After updating to TypeScript version 4.5.5, we are getting the below error message

error TS2339: Property 'setCodecPreferences' does not exist on type 'RTCRtpTransceiver'

TypeScript 4.4 libdom changes suggest that function 'setCodecPreferences' is removed in TypeScript 4.4 but not finding any reason. enter image description here

I have 2 questions

  1. How to fix the above issue or Do we have any alternatives? other than (transceiver as any)

  2. Is there any way where we can build code based on 'TypeScript' version i.e. if 'Typescript' version is bellow 4.4 execute specific lines of code, else other.

0 Answers
Related