mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 10:01: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,9 @@
|
||||
const element: HTMLDivElement = document.createElement('div')
|
||||
const value: string | undefined = ['first'][1]
|
||||
void [element, value]
|
||||
|
||||
// @ts-expect-error Node globals must not leak into browser packages.
|
||||
globalThis.process.cwd() // eslint-disable-line node/prefer-global/process -- Check that browser projects cannot see ambient Node globals.
|
||||
// @ts-expect-error Array indexing may return undefined in implementation checks.
|
||||
const unchecked: string = ['first'][1]
|
||||
void unchecked
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"risk": "BASE-TYPE-01",
|
||||
"owners": [
|
||||
"ENG-07",
|
||||
"CORE-07",
|
||||
"PKG-CHAPTER-04"
|
||||
],
|
||||
"scope": "Existing workspace NodeNext ESM failure, not a candidate waiver. Remove expected failures when a documented fix adds passing consumer assertions.",
|
||||
"diagnostics": [
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2349,
|
||||
"line": 8,
|
||||
"message": "This expression is not callable.\n Type 'typeof import(\"<workspace>/packages/artplayer-plugin-chapter/types/artplayer-plugin-chapter\")' has no call signatures."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2351,
|
||||
"line": 10,
|
||||
"message": "This expression is not constructable.\n Type 'typeof import(\"<workspace>/packages/artplayer/types/artplayer\")' has no construct signatures."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 7006,
|
||||
"line": 10,
|
||||
"message": "Parameter 'player' implicitly has an 'any' type."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2709,
|
||||
"line": 12,
|
||||
"message": "Cannot use namespace 'Artplayer' as a type."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2683,
|
||||
"line": 12,
|
||||
"message": "'this' implicitly has type 'any' because it does not have a type annotation."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2339,
|
||||
"line": 17,
|
||||
"message": "Property 'html' does not exist on type 'typeof import(\"<workspace>/packages/artplayer/types/artplayer\")'."
|
||||
},
|
||||
{
|
||||
"file": "test/types/consumer.ts",
|
||||
"code": 2349,
|
||||
"line": 18,
|
||||
"message": "This expression is not callable.\n Type 'typeof import(\"<workspace>/packages/artplayer-plugin-chapter/types/artplayer-plugin-chapter\")' has no call signatures."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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