Skip to content

Commit

Permalink
fix: lint issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Apr 23, 2021
1 parent 6fbac7f commit 66b0f23
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/factory/createHTMLMediaHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export interface HTMLMediaControls {

type MediaPropsWithRef<T> = HTMLMediaProps & { ref?: React.MutableRefObject<T | null> };

export default function createHTMLMediaHook<T extends HTMLAudioElement | HTMLVideoElement>(tag: 'audio' | 'video') {
return (
elOrProps: HTMLMediaProps | React.ReactElement<HTMLMediaProps>
) => {
let element: React.ReactElement<MediaPropsWithRef<T>> | undefined;
let props: MediaPropsWithRef<T>;
export default function createHTMLMediaHook<T extends HTMLAudioElement | HTMLVideoElement>(
tag: 'audio' | 'video'
) {
return (elOrProps: HTMLMediaProps | React.ReactElement<HTMLMediaProps>) => {
let element: React.ReactElement<MediaPropsWithRef<T>> | undefined;
let props: MediaPropsWithRef<T>;

if (React.isValidElement(elOrProps)) {
element = elOrProps;
Expand All @@ -51,7 +51,7 @@ export default function createHTMLMediaHook<T extends HTMLAudioElement | HTMLVid
muted: false,
volume: 1,
});
const ref = useRef<T | null>(null);
const ref = useRef<T | null>(null);

const wrapEvent = (userEvent, proxyEvent?) => {
return (event) => {
Expand Down Expand Up @@ -229,6 +229,6 @@ export default function createHTMLMediaHook<T extends HTMLAudioElement | HTMLVid
}
}, [props.src]);

return [element, state, controls, ref] as const;
}
};
return [element, state, controls, ref] as const;
};
}

0 comments on commit 66b0f23

Please sign in to comment.