import Artplayer from 'artplayer' import chromecast from 'artplayer-plugin-chromecast' interface Option { url?: string, sdk?: string, icon?: string, mimeType?: string } interface Result { name: 'artplayerPluginChromecast' } type Factory = (option: Option) => (art: Artplayer) => Result type Equal = (() => T extends A ? 1 : 2) extends (() => T extends B ? 1 : 2) ? true : false type Assert = T type SameArguments = Assert, [option: Option]>> type SameResult = Assert>, Result>> const replacement: Factory = (_option: Option) => (_art: Artplayer) => ({ name: 'artplayerPluginChromecast' }) const toOld: Factory = chromecast const fromOld: typeof chromecast = replacement const art = new Artplayer({ container: '#player', url: '/video.mp4', plugins: [chromecast({})] }) const name: 'artplayerPluginChromecast' = chromecast({ url: '/cast.mp4', sdk: '/sdk.js', icon: 'Cast', mimeType: 'video/mp4' })(art).name void [toOld, fromOld, name] export type { SameArguments, SameResult }