Skip to content

Commit

Permalink
fix: ensure lazy typedefs mirror defaults
Browse files Browse the repository at this point in the history
Fixes #1146
  • Loading branch information
jahed committed Jan 23, 2021
1 parent 22bf858 commit 35fab91
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 34 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.8.1",
"description": "A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion",
"main": "lib/index.js",
"typings": "index.d.ts",
"typings": "lib/index.d.ts",
"scripts": {
"clean": "rimraf lib lazy demo coverage *.d.ts",
"start": "webpack-dev-server --config webpack/config.babel.js",
Expand All @@ -21,7 +21,7 @@
"build:standalone": "cross-env NODE_ENV=production webpack --config webpack/standalone.babel.js",
"preversion": "npm run lint && npm run test",
"version": "auto-changelog -p && npm run build:dist && npm run build:standalone && git add CHANGELOG.md dist",
"prepublishOnly": "npm run build:lib && npm run build:lazy && npm run build:dist && node scripts/pre-publish.js && cp types/*.d.ts . && cp types/index.d.ts lazy",
"prepublishOnly": "npm run build:lib && npm run build:lazy && npm run build:dist && node scripts/pre-publish.js && cp types/*.d.ts . && cp types/lib/index.d.ts lib && cp types/lib/index.d.ts lazy",
"postpublish": "node scripts/post-publish.js && npm run clean"
},
"repository": {
Expand Down
30 changes: 29 additions & 1 deletion types/base.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { Component, ReactElement, CSSProperties } from 'react'
import ReactPlayer from './index'
import { DailyMotionConfig } from './dailymotion'
import { FacebookConfig } from './facebook'
import { FileConfig } from './file'
import { MixcloudConfig } from './mixcloud'
import { SoundCloudConfig } from './soundcloud'
import { TwitchConfig } from './twitch'
import { VidyardConfig } from './vidyard'
import { VimeoConfig } from './vimeo'
import { WistiaConfig } from './wistia'
import { YouTubeConfig } from './youtube'

interface SourceProps {
src: string
Expand Down Expand Up @@ -59,3 +68,22 @@ export default class BaseReactPlayer<T extends BaseReactPlayerProps> extends Com
getInternalPlayer (key?: string): Record<string, any>;
showPreview (): void;
}

export interface Config {
soundcloud?: SoundCloudConfig
youtube?: YouTubeConfig
facebook?: FacebookConfig
dailymotion?: DailyMotionConfig
vimeo?: VimeoConfig
file?: FileConfig
wistia?: WistiaConfig
mixcloud?: MixcloudConfig
vidyard?: VidyardConfig
twitch?: TwitchConfig
}

export interface ReactPlayerProps extends BaseReactPlayerProps {
config?: Config
}

export class ReactPlayer extends BaseReactPlayer<ReactPlayerProps> {}
31 changes: 0 additions & 31 deletions types/index.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions types/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Config, ReactPlayerProps, ReactPlayer as default } from '../base'

0 comments on commit 35fab91

Please sign in to comment.