mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 01:56:16 -08:00
refactor(iframe): [PKG-IFRAME-04] preserve types across module consumers
This commit is contained in:
1 parent
1342de94ef
commit
047e2df945
24 files changed
+1496
-69
No files matched your search
@@ -0,0 +1,16 @@
|
||||
/* eslint-disable ts/no-require-imports -- Verify native TypeScript CommonJS constructor imports. */
|
||||
import Iframe = require('artplayer-tool-iframe')
|
||||
import Legacy = require('artplayer-tool-iframe/legacy')
|
||||
|
||||
declare const frame: HTMLIFrameElement
|
||||
const option: Iframe.Option = { iframe: frame, url: '/frame' }
|
||||
const tool: Iframe = new Iframe(option)
|
||||
const old: Legacy = new Legacy(option)
|
||||
const message: Iframe.Message<number> = { type: 'custom', data: 2 }
|
||||
tool.postMessage(message)
|
||||
old.commit(() => {
|
||||
return 2
|
||||
})
|
||||
// @ts-expect-error Direct CommonJS constructor has no default namespace.
|
||||
const wrong = Iframe.default
|
||||
void wrong
|
||||
Reference in new issue
Block a user