Skip to content

Updated TypeScript typings#235

Merged
cookpete merged 1 commit into
cookpete:masterfrom
Tenga:typing-tweaks
Sep 14, 2017
Merged

Updated TypeScript typings#235
cookpete merged 1 commit into
cookpete:masterfrom
Tenga:typing-tweaks

Conversation

@Tenga

@Tenga Tenga commented Sep 14, 2017

Copy link
Copy Markdown
Contributor

This PR will update the TS typings, as they seem to have gone out of date with the 2.4 config changes.

I've made each property in each config optional, as from what I can tell, most of them have defaults and are not mandatory. It also allows the authors to pass in partial objects (file config with just attributes instead of forcing you to define tracks, forceAudio, etc.)

Each individual config for each video provider are also now their own exported interfaces so you can reuse the types without having to recreate them yourself in cases like this:

import ReactPlayer, { FileConfig, TrackProps } from "react-player";

// ...
const getTracks = (): TrackProps[] => {
  // Whatever get tracks does...
}

// ...
const fileConfig: FileConfig = {
  tracks: getTracks(),
}

// ...
<ReactPlayer config={{ file: fileConfig }} />

@cookpete

Copy link
Copy Markdown
Owner

Nice work 👍

@cookpete
cookpete merged commit 9a5ad20 into cookpete:master Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants