fix(typescript): type checks on selectedTextTrack, selectedAudioTrack, selectedVideoTrack (#3910)
* Fix type checks on selectedTextTrack and selectedAudioTrack * Improve logging * Rename variable for clarity * Apply same fix to selectedVideoTrack * Lint fixes * Update src/Video.tsx Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> * Update src/Video.tsx Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> * Update src/Video.tsx Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> --------- Co-authored-by: Krzysztof Moch <krzysmoch.programs@gmail.com> Co-authored-by: Olivier Bouillet <62574056+freeboub@users.noreply.github.com>
This commit is contained in:
parent
87e7f42042
commit
dc2a2ab863
@ -193,9 +193,16 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
if (!selectedTextTrack) {
|
||||
return;
|
||||
}
|
||||
const type = typeof selectedTextTrack.value;
|
||||
if (type !== 'number' && type !== 'string') {
|
||||
console.log('invalid type provided to selectedTextTrack');
|
||||
const typeOfValueProp = typeof selectedTextTrack.value;
|
||||
if (
|
||||
typeOfValueProp !== 'number' &&
|
||||
typeOfValueProp !== 'string' &&
|
||||
typeOfValueProp !== 'undefined'
|
||||
) {
|
||||
console.warn(
|
||||
'invalid type provided to selectedTextTrack.value: ',
|
||||
typeOfValueProp,
|
||||
);
|
||||
return;
|
||||
}
|
||||
return {
|
||||
@ -208,9 +215,16 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
if (!selectedAudioTrack) {
|
||||
return;
|
||||
}
|
||||
const type = typeof selectedAudioTrack.value;
|
||||
if (type !== 'number' && type !== 'string') {
|
||||
console.log('invalid type provided to selectedAudioTrack');
|
||||
const typeOfValueProp = typeof selectedAudioTrack.value;
|
||||
if (
|
||||
typeOfValueProp !== 'number' &&
|
||||
typeOfValueProp !== 'string' &&
|
||||
typeOfValueProp !== 'undefined'
|
||||
) {
|
||||
console.warn(
|
||||
'invalid type provided to selectedAudioTrack.value: ',
|
||||
typeOfValueProp,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -224,9 +238,16 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
|
||||
if (!selectedVideoTrack) {
|
||||
return;
|
||||
}
|
||||
const type = typeof selectedVideoTrack.value;
|
||||
if (type !== 'number' && type !== 'string') {
|
||||
console.log('invalid type provided to selectedVideoTrack');
|
||||
const typeOfValueProp = typeof selectedVideoTrack.value;
|
||||
if (
|
||||
typeOfValueProp !== 'number' &&
|
||||
typeOfValueProp !== 'string' &&
|
||||
typeOfValueProp !== 'undefined'
|
||||
) {
|
||||
console.warn(
|
||||
'invalid type provided to selectedVideoTrack.value: ',
|
||||
typeOfValueProp,
|
||||
);
|
||||
return;
|
||||
}
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user