mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 11:11:20 -08:00
refactor(types): CORE-07 reconcile public declarations and preserve legacy consumers
This commit is contained in:
1 parent
ee859e4804
commit
f9707bad71
34 files changed
+2806
-85
No files matched your search
@@ -1,9 +1,9 @@
|
||||
import type { Option, ResolvedInput, ResolvedOption } from './types'
|
||||
import type { OptionInput, ResolvedInput, ResolvedOption } from './types'
|
||||
import validator from 'option-validator'
|
||||
import scheme from '../scheme'
|
||||
import { mergeDeep } from '../utils/property'
|
||||
|
||||
export default function resolveOption<Input extends Option>(input: Input, defaults: ResolvedOption): ResolvedInput<Input> {
|
||||
export default function resolveOption<Input extends OptionInput>(input: Input, defaults: ResolvedOption): ResolvedInput<Input> {
|
||||
const merged = mergeDeep(defaults, input)
|
||||
merged.container = input.container
|
||||
// Keep the existing runtime validator. It checks the known schema, not extension data.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { Option, Thumbnails } from '../../types/option'
|
||||
import type { OptionInput, Thumbnails } from '../../types/option'
|
||||
import type { Subtitle } from '../../types/subtitle'
|
||||
|
||||
export type { Option } from '../../types/option'
|
||||
export type { Option, OptionInput } from '../../types/option'
|
||||
|
||||
// A successfully merged typed input, not a general guard for arbitrary JS objects.
|
||||
export interface ResolvedOption extends Omit<Required<Option>, 'proxy' | 'subtitle' | 'thumbnails'> {
|
||||
proxy: Option['proxy']
|
||||
export interface ResolvedOption extends Omit<Required<OptionInput>, 'proxy' | 'subtitle' | 'thumbnails'> {
|
||||
proxy: OptionInput['proxy']
|
||||
subtitle: Required<Subtitle>
|
||||
thumbnails: Required<Thumbnails>
|
||||
}
|
||||
|
||||
export type ResolvedInput<Input extends Option> = ResolvedOption & Omit<Input, keyof Option>
|
||||
export type ResolvedInput<Input extends OptionInput> = ResolvedOption & Omit<Input, keyof OptionInput>
|
||||
Reference in new issue
Block a user