mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 18:11:20 -08:00
fix: align promise helper types and test playback rejections
This commit is contained in:
1 parent
0f47e11d63
commit
72cf3551e2
13 files changed
+191
-44
No files matched your search
@@ -0,0 +1,10 @@
|
||||
import type { Utils } from '../packages/artplayer/types/utils'
|
||||
|
||||
export function checkSilencePromiseTypes(utils: Utils, thenable: PromiseLike<number>) {
|
||||
const promise: Promise<number | undefined> = utils.silencePromise(Promise.resolve(42))
|
||||
const synchronous: undefined = utils.silencePromise(undefined)
|
||||
const unchanged: PromiseLike<number> = utils.silencePromise(thenable)
|
||||
// @ts-expect-error A catch-less thenable is not converted to a native Promise.
|
||||
utils.silencePromise(thenable).catch(() => {})
|
||||
return { promise, synchronous, unchanged }
|
||||
}
|
||||
Reference in new issue
Block a user