mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
build(types): ENG-04 add strict projects and legacy compiler checks
This commit is contained in:
1 parent
09902b8b8c
commit
771482426f
22 files changed
+346
-49
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import type { Option } from 'artplayer'
|
||||
import Artplayer from 'artplayer'
|
||||
import chapter from 'artplayer-plugin-chapter'
|
||||
|
||||
const options: Option = {
|
||||
container: '#player',
|
||||
url: 'video.mp4',
|
||||
plugins: [chapter({ chapters: [{ start: 0, end: 5, title: 'First' }] })],
|
||||
}
|
||||
const art = new Artplayer(options, function (player) {
|
||||
// eslint-disable-next-line ts/no-this-alias -- Assert the public ready callback receiver type.
|
||||
const self: Artplayer = this
|
||||
self.pause()
|
||||
player.seek = 1
|
||||
})
|
||||
const playback: Promise<void> = art.play()
|
||||
const html: string = Artplayer.html
|
||||
const plugin = chapter({})(art)
|
||||
plugin.update({ chapters: [] })
|
||||
art.on('custom', (value: unknown) => value)
|
||||
void [playback, html]
|
||||
|
||||
// @ts-expect-error A media URL is a string.
|
||||
const invalid = new Artplayer({ container: '#player', url: 42 })
|
||||
void invalid
|
||||
// @ts-expect-error Chapter start times are numeric.
|
||||
chapter({ chapters: [{ start: '0', end: 5, title: 'Invalid' }] })
|
||||
Reference in new issue
Block a user