Skip to content

Commit

Permalink
[#285] strictNullChecks: true, fix 12 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwebdev committed Nov 16, 2023
1 parent 1163391 commit 80417b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/ebay-video/__tests__/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const defaultProps: EbayVideoProps = {
errorText: "An error has occurred",
width: 600,
height: 400,
onPlay: (e: SyntheticEvent<HTMLVideoElement>, props: PlayEventProps) => action('onPlay')(e, props),
onVolumeChange: (e: SyntheticEvent<HTMLVideoElement>, props: VolumeChangeProps) => action('onVolumeChange')(e, props),
onLoadError: (err: Error) => action('onLoadError')(err),
onPlay: (e, props) => action('onPlay')(e, props),
onVolumeChange: (e, props) => action('onVolumeChange')(e, props),
onLoadError: (err) => action('onLoadError')(err),
onReport: (e) => action('onReport')(e),
}

Expand Down
26 changes: 16 additions & 10 deletions src/ebay-video/video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const EbayVideo: FC<EbayVideoProps> = ({

const containerRef = useRef<HTMLDivElement>(null)
const videoRef = useRef<HTMLVideoElement>(null)
const playerRef = useRef<Player>(null)
const uiRef = useRef(null)
const playerRef = useRef<Player | null>(null)
const uiRef = useRef<any>(null)

const sources = filterByType(children, EbayVideoSource).map(elementProps)

Expand Down Expand Up @@ -143,7 +143,7 @@ const EbayVideo: FC<EbayVideoProps> = ({
video,
reportText
)
uiRef.current.configure({
uiRef.current?.configure({
addBigPlayButton: true,
controlPanelElements: [],
addSeekBar: false
Expand All @@ -166,10 +166,10 @@ const EbayVideo: FC<EbayVideoProps> = ({
useEffect(() => {
switch (action) {
case 'play':
videoRef.current.play()
videoRef.current?.play()
break
case 'pause':
videoRef.current.pause()
videoRef.current?.pause()
break
default:
}
Expand All @@ -186,7 +186,9 @@ const EbayVideo: FC<EbayVideoProps> = ({
...defaultVideoConfig,
...updatedControls
})
videoRef.current.controls = false
if (videoRef.current) {
videoRef.current.controls = false
}
}

const handlePlaying = (e: SyntheticEvent<HTMLVideoElement, Event>) => {
Expand All @@ -195,15 +197,17 @@ const EbayVideo: FC<EbayVideoProps> = ({
showControls()

if (playView === 'fullscreen') {
videoRef.current.requestFullscreen()
videoRef.current?.requestFullscreen()
}

setPlaying(true)
onPlay(e, { player: playerRef.current })
if (playerRef.current) {
onPlay(e, { player: playerRef.current })
}
}

const handleOnPlayClick = () => {
videoRef.current.play()
videoRef.current?.play()
}

const handleVolumeChange = (e: SyntheticEvent<HTMLVideoElement, Event>) => {
Expand All @@ -217,7 +221,9 @@ const EbayVideo: FC<EbayVideoProps> = ({
const handleOnPause = () => {
// On IOS, the controls force showing up if the video exist fullscreen while playing.
// This forces the controls to always hide
videoRef.current.controls = false
if (videoRef.current) {
videoRef.current.controls = false
}
}

const style = {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"strict": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": false, // 150+ errors
"strictNullChecks": true,
"strictPropertyInitialization": false,
"useUnknownInCatchVariables": true,
"noImplicitAny": false, // 300+ errors
Expand Down

0 comments on commit 80417b1

Please sign in to comment.