4d4f845b9e
Turning the "importsNotUsedAsValues" TS config value to "error". This will require us to use `import type` instead of `import` when we are importing a value that is only used as a type (and therefore that is dropped by the Typescript compiler). Why this change? This is a requirement to be able to use Svelte in the future. See https://github.com/sveltejs/svelte-preprocess/issues/206#issuecomment-663193798
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
|
|
|
|
import type { ButtonClickedEvent } from './ButtonClickedEvent';
|
|
import type { ChatEvent } from './ChatEvent';
|
|
import type { ClosePopupEvent } from './ClosePopupEvent';
|
|
import type { EnterLeaveEvent } from './EnterLeaveEvent';
|
|
import type { GoToPageEvent } from './GoToPageEvent';
|
|
import type { OpenCoWebSiteEvent } from './OpenCoWebSiteEvent';
|
|
import type { OpenPopupEvent } from './OpenPopupEvent';
|
|
import type { OpenTabEvent } from './OpenTabEvent';
|
|
import type { UserInputChatEvent } from './UserInputChatEvent';
|
|
|
|
|
|
export interface TypedMessageEvent<T> extends MessageEvent {
|
|
data: T
|
|
}
|
|
|
|
export type IframeEventMap = {
|
|
//getState: GameStateEvent,
|
|
// updateTile: UpdateTileEvent
|
|
chat: ChatEvent,
|
|
openPopup: OpenPopupEvent
|
|
closePopup: ClosePopupEvent
|
|
openTab: OpenTabEvent
|
|
goToPage: GoToPageEvent
|
|
openCoWebSite: OpenCoWebSiteEvent
|
|
closeCoWebSite: null
|
|
disablePlayerControls: null
|
|
restorePlayerControls: null
|
|
displayBubble: null
|
|
removeBubble: null
|
|
}
|
|
export interface IframeEvent<T extends keyof IframeEventMap> {
|
|
type: T;
|
|
data: IframeEventMap[T];
|
|
}
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export const isIframeEventWrapper = (event: any): event is IframeEvent<keyof IframeEventMap> => typeof event.type === 'string';
|
|
|
|
export interface IframeResponseEventMap {
|
|
userInputChat: UserInputChatEvent
|
|
enterEvent: EnterLeaveEvent
|
|
leaveEvent: EnterLeaveEvent
|
|
buttonClickedEvent: ButtonClickedEvent
|
|
// gameState: GameStateEvent
|
|
}
|
|
export interface IframeResponseEvent<T extends keyof IframeResponseEventMap> {
|
|
type: T;
|
|
data: IframeResponseEventMap[T];
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export const isIframeResponseEventWrapper = (event: { type?: string }): event is IframeResponseEvent<keyof IframeResponseEventMap> => typeof event.type === 'string';
|