From 3c98bc1a02ca93d7749f63f8d6fb71f5d77445e4 Mon Sep 17 00:00:00 2001 From: Timur Manyanov <2737310+darkwebdev@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:48:34 +0200 Subject: [PATCH 1/3] [#259] Export Player type --- src/ebay-video/shaka-player.d.ts | 2 +- src/ebay-video/types.ts | 2 ++ src/ebay-video/video.tsx | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ebay-video/shaka-player.d.ts b/src/ebay-video/shaka-player.d.ts index 2ee8808e..c1af5c05 100644 --- a/src/ebay-video/shaka-player.d.ts +++ b/src/ebay-video/shaka-player.d.ts @@ -3,4 +3,4 @@ declare module 'shaka-player' declare module 'shaka-player/dist/shaka-player.ui' declare module 'shaka-player/dist/shaka-player.ui.debug' -type Player = Record +export type Player = Record diff --git a/src/ebay-video/types.ts b/src/ebay-video/types.ts index c220a59e..9e8c268d 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 { Player } from './shaka-player' diff --git a/src/ebay-video/video.tsx b/src/ebay-video/video.tsx index c1ba3f88..35fc838d 100644 --- a/src/ebay-video/video.tsx +++ b/src/ebay-video/video.tsx @@ -5,7 +5,7 @@ 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' From 0555b73881ee317fae11f75fd7efd087b391c052 Mon Sep 17 00:00:00 2001 From: Timur Manyanov <2737310+darkwebdev@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:23:30 +0200 Subject: [PATCH 2/3] [#259] Ignore broken player definitions --- .eslintrc | 2 ++ src/ebay-video/controls.tsx | 5 ++++- src/ebay-video/video.tsx | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) 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/video.tsx b/src/ebay-video/video.tsx index 35fc838d..563b4752 100644 --- a/src/ebay-video/video.tsx +++ b/src/ebay-video/video.tsx @@ -1,5 +1,7 @@ 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' From be51d34268e1626747247bc68c48bb1e22caa41e Mon Sep 17 00:00:00 2001 From: Timur Manyanov <2737310+darkwebdev@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:43:28 +0200 Subject: [PATCH 3/3] [#259] Update export --- src/ebay-video/shaka-player.d.ts | 2 -- src/ebay-video/types.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ebay-video/shaka-player.d.ts b/src/ebay-video/shaka-player.d.ts index c1af5c05..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' - -export type Player = Record diff --git a/src/ebay-video/types.ts b/src/ebay-video/types.ts index 9e8c268d..8ddc3668 100644 --- a/src/ebay-video/types.ts +++ b/src/ebay-video/types.ts @@ -7,4 +7,4 @@ export type VideoSource = { type?: VideoSourceType } -export { Player } from './shaka-player' +export type Player = Record