use a better type for plugin options, one that can be extended (#39218)

* use a better type for plugin options, one that can be extended

* fix lint issue and add a test case
This commit is contained in:
Joe Flateau 2019-10-22 16:20:19 -04:00 committed by Wesley Wigham
parent 0bd57b50be
commit ddb94b86a0
3 changed files with 15 additions and 1 deletions

View File

@ -6710,7 +6710,7 @@ declare namespace videojs {
nativeControlsForTouch?: boolean;
notSupportedMessage?: string;
playbackRates?: number[];
plugins?: any;
plugins?: VideoJsPlayerPluginOptions;
poster?: string;
preload?: string;
sourceOrder?: boolean;
@ -6720,3 +6720,7 @@ declare namespace videojs {
tracks?: videojs.TextTrackOptions[];
width?: number;
}
export interface VideoJsPlayerPluginOptions {
[pluginName: string]: any;
}

View File

@ -7,4 +7,8 @@ declare module 'video.js' {
interface VideoJsPlayer {
somePluginDefinedInAugmentation(options?: {}): this;
}
interface VideoJsPlayerPluginOptions {
somePluginDefinedInAugmentation: {};
}
}

View File

@ -120,4 +120,10 @@ function testPlugin(player: videojs.Player, options: {}) {
function testAugmentation(player: videojs.Player) {
player.somePluginDefinedInAugmentation();
videojs("example_video_2", {
plugins: {
somePluginDefinedInAugmentation: {},
someOtherPluginNotTyped: {}
}
});
}