mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
fix: Clean up more typescript errors.
This commit is contained in:
committed by
Christian Pillsbury
parent
3cffb4d59a
commit
87105db6be
@@ -30,7 +30,9 @@ export type ReadonlyFacadeProp<T, D = T> = {
|
||||
export type FacadeProp<T, S = T, D = T> = ReadonlyFacadeProp<T, D> & {
|
||||
set: FacadeSetter<S>;
|
||||
/** @TODO We probably need to refactor this for more complex cases where we can't simply translate to a setter */
|
||||
actions: { [k: string]: (val: CustomEvent<any>) => ReturnType<FacadeGetter<T, D>> };
|
||||
actions: {
|
||||
[k: string]: (val: CustomEvent<any>) => ReturnType<FacadeGetter<T, D>>;
|
||||
};
|
||||
};
|
||||
|
||||
export type StateMediator = {
|
||||
@@ -99,8 +101,6 @@ export function createMediaStore({
|
||||
)) {
|
||||
const { set, actions } = stateObject;
|
||||
if (type in actions) {
|
||||
/** @TODO FIXME ASAP!!! (CJP) */
|
||||
// @ts-ignore
|
||||
set(actions[type as keyof typeof actions](), stateOwners);
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ export function createMediaStore({
|
||||
// NOTE: In the POC architecture using nano-stores, subscribe is simply subscribeKeys across all keys. (CJP)
|
||||
subscribe(callback: (state: any) => void) {
|
||||
subscribeKeys(store, keys, callback);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -131,4 +131,4 @@ function getInitialState(
|
||||
initialState[stateName] = get(stateOwners);
|
||||
}
|
||||
return initialState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ export interface IAudibleMediaStateOwner
|
||||
IBaseMediaStateOwner,
|
||||
Pick<HTMLMediaElement, 'muted' | 'volume'> {}
|
||||
|
||||
// @ts-ignore - Interface compatibility issues with undefined mediaElement
|
||||
export class PlayableMediaStateOwner
|
||||
extends EventTarget
|
||||
implements IPlayableMediaStateOwner, IAudibleMediaStateOwner
|
||||
@@ -98,8 +97,11 @@ export class PlayableMediaStateOwner
|
||||
|
||||
handleEvent(event: Event): void {
|
||||
if (event.target === this.mediaElement) {
|
||||
// @ts-ignore
|
||||
const clonedEvent = new event.constructor(event.type, event);
|
||||
const clonedEvent =
|
||||
new (event.constructor as (typeof globalThis)['Event'])(
|
||||
event.type,
|
||||
event,
|
||||
);
|
||||
this.dispatchEvent(clonedEvent);
|
||||
}
|
||||
}
|
||||
@@ -110,4 +112,4 @@ export class PlayableMediaStateOwner
|
||||
}
|
||||
}
|
||||
|
||||
export const createMediaStateOwner = () => new PlayableMediaStateOwner();
|
||||
export const createMediaStateOwner = () => new PlayableMediaStateOwner();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ProviderMixin } from '@open-wc/context-protocol';
|
||||
import { createMediaStore } from '@vjs-10/media-store';
|
||||
|
||||
// @ts-ignore - Custom element constructor compatibility
|
||||
export class MediaProvider extends ProviderMixin(HTMLElement) {
|
||||
contexts = {
|
||||
mediaStore: () => {
|
||||
@@ -10,5 +9,4 @@ export class MediaProvider extends ProviderMixin(HTMLElement) {
|
||||
};
|
||||
}
|
||||
|
||||
// @ts-ignore - Custom elements type compatibility
|
||||
customElements.define('media-provider', MediaProvider);
|
||||
customElements.define('media-provider', MediaProvider);
|
||||
|
||||
Reference in New Issue
Block a user