mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
refactor(core): [CORE-20] type entry and converge initialization
This commit is contained in:
1 parent
ccf77c4ed2
commit
ee895a558f
100 files changed
+33854
-839
No files matched your search
@@ -1,10 +1,14 @@
|
||||
import { def, getIcon } from '../utils'
|
||||
import defaults from './defaults'
|
||||
|
||||
export default class Icons {
|
||||
// eslint-disable-next-line ts/no-unsafe-declaration-merging -- The constructor defines a getter for every default key without class fields.
|
||||
interface Icons extends Record<keyof typeof defaults, HTMLElement> {}
|
||||
|
||||
// eslint-disable-next-line ts/no-unsafe-declaration-merging -- The merged mapped interface describes the getters installed below.
|
||||
class Icons {
|
||||
readonly [key: string]: HTMLElement
|
||||
|
||||
constructor(art: { option: { icons: Record<string, string | HTMLElement> } }) {
|
||||
constructor(art: { option: { icons: Readonly<Record<string, string | HTMLElement | undefined>> } }) {
|
||||
const icons: Record<string, string | HTMLElement | undefined> = { ...defaults, ...art.option.icons }
|
||||
for (const key in icons) {
|
||||
def(this, key, {
|
||||
@@ -13,3 +17,5 @@ export default class Icons {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Icons
|
||||
Reference in new issue
Block a user