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

Updated TypeScript typings #235

Merged
merged 1 commit into from
Sep 14, 2017
Merged

Updated TypeScript typings #235

merged 1 commit into from
Sep 14, 2017

Conversation

Tenga
Copy link
Contributor

@Tenga Tenga commented Sep 14, 2017

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
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