diff --git a/.eslintrc b/.eslintrc index 17590092..10b099b2 100644 --- a/.eslintrc +++ b/.eslintrc @@ -54,6 +54,8 @@ "args": "none" } ], + // need that for shaka-player workaround + "@typescript-eslint/ban-ts-comment": "off", // works incorrectly with type imports "no-import-assign": "off", "react/prop-types": "off", diff --git a/src/ebay-video/controls.tsx b/src/ebay-video/controls.tsx index d50912db..66ae2879 100644 --- a/src/ebay-video/controls.tsx +++ b/src/ebay-video/controls.tsx @@ -1,11 +1,14 @@ import React, { ReactElement } from 'react' import ReactDOM from 'react-dom' +// need that for broken definitions workaround +// @ts-ignore import { ui } from 'shaka-player/dist/shaka-player.ui' import { ReportButton } from './reportButton' export function customControls(onReport = () => {}): { Report } { // Have to contain in order to not execute until shaka is downloaded - const Report = class extends ui.Element { + // eslint-disable-next-line no-extra-parens + const Report = class extends (ui.Element as any) { constructor(parent, controls, text) { super(parent, controls) diff --git a/src/ebay-video/shaka-player.d.ts b/src/ebay-video/shaka-player.d.ts index 2ee8808e..850b88e3 100644 --- a/src/ebay-video/shaka-player.d.ts +++ b/src/ebay-video/shaka-player.d.ts @@ -2,5 +2,3 @@ declare module 'shaka-player' declare module 'shaka-player/dist/shaka-player.ui' declare module 'shaka-player/dist/shaka-player.ui.debug' - -type Player = Record diff --git a/src/ebay-video/types.ts b/src/ebay-video/types.ts index c220a59e..8ddc3668 100644 --- a/src/ebay-video/types.ts +++ b/src/ebay-video/types.ts @@ -6,3 +6,5 @@ export type VideoSource = { src: string; type?: VideoSourceType } + +export type Player = Record diff --git a/src/ebay-video/video.tsx b/src/ebay-video/video.tsx index c1ba3f88..563b4752 100644 --- a/src/ebay-video/video.tsx +++ b/src/ebay-video/video.tsx @@ -1,11 +1,13 @@ import React, { ComponentProps, FC, SyntheticEvent, MouseEvent, useEffect, useRef, useState } from 'react' import classNames from 'classnames' +// need that for broken definitions workaround +// @ts-ignore import shaka from 'shaka-player/dist/shaka-player.ui' import { filterByType } from '../common/component-utils' import { EbayIcon } from '../ebay-icon' import { EbayProgressSpinner } from '../ebay-progress-spinner' -import { VideoAction, VideoPlayView } from './types' +import { Player, VideoAction, VideoPlayView } from './types' import EbayVideoSource from './source' import { defaultVideoConfig, ERROR_ANOTHER_LOAD, ERROR_NO_PLAYER } from './const' import { customControls } from './controls'