Commits
David Castillo authored and GitHub committed 85b6431353b
Fixes type of the onStatusChange callback in types/index.d.ts
Currently, the `onStatusChange` has a type of
```ts
onStatusChange?(event: {
cameraStatus: CameraStatus;
recordAudioPermissionStatus: keyof RecordAudioPermissionStatus;
}): void
```
Which makes it very inconvenient to use with Typescript, having to set the `cameraStatus` field to `any` in the passed function:
```ts
const handleStatusChange = (event: {cameraStatus: any}) => {
if (event.cameraStatus === 'NOT_AUTHORIZED') {
}
}
```
By changing it to
```ts
onStatusChange?(event: {
cameraStatus: keyof CameraStatus;
recordAudioPermissionStatus: keyof RecordAudioPermissionStatus;
}): void
```
we're able to compare the new status against the intended type, autocomplete, and discard the `any`:
```ts
const handleStatusChange = (event: {cameraStatus: keyof CameraStatus}) => {
if (event.cameraStatus === 'NOT_AUTHORIZED') {
onUnauthorized()
}
}
```