fix: Clean up more typescript errors.

This commit is contained in:
Christian Pillsbury
2025-08-19 08:41:08 -07:00
committed by Christian Pillsbury
parent 3cffb4d59a
commit 87105db6be
3 changed files with 12 additions and 12 deletions
+5 -5
View File
@@ -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;
}
}
+6 -4
View File
@@ -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);