Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX EbayVideo: [#259] Fix shaka-player types #262

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/ebay-video/controls.tsx
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 0 additions & 2 deletions src/ebay-video/shaka-player.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, any>
2 changes: 2 additions & 0 deletions src/ebay-video/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export type VideoSource = {
src: string;
type?: VideoSourceType
}

export type Player = Record<string, any>
4 changes: 3 additions & 1 deletion src/ebay-video/video.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Loading