Previously when using this library from typescript, importing AgoraRTCErrorCode would pass type checks even though nothing was actually exported, causing an undefined exception at run time.
For example:
import { AgoraRTCErrorCode, createMicrophoneAndCameraTracks } from 'agora-rtc-react';
try {
createMicrophoneAndCameraTracks()
} catch (e) {
if (e.code === AgoraRTCErrorCode.PERMISSION_DENIED) {
// ^--- throws exception because AgoraRTCErrorCode is undefined
console.log("User did not give camera/mic permissions");
} else {
throw e;
}
}
After this PR, the code example will work without an exception being thrown.
Previously when using this library from typescript, importing
AgoraRTCErrorCode
would pass type checks even though nothing was actually exported, causing an undefined exception at run time.For example:
After this PR, the code example will work without an exception being thrown.