import { Action } from 'redux' ; import { PayloadAction } from '@reduxjs/toolkit' ; import { ReduxStoreType } from '../redux/mainReducer' ; export interface SizedEvent { target : { width : number ; height : number ; } ; } export function isSizedEvent ( e ) { return ( e && e . target && e . target . width !== undefined && e . target . height !== undefined ) ; } export type GToveThunk < A extends Action > = ( dispatch : ( action : A ) => A , getState : ( ) => ReduxStoreType ) => void ; export interface ScenarioAction extends NetworkedAction { actionId : string ; headActionIds : string [ ] ; peerKey : string ; gmOnly : boolean ; playersOnly ? : boolean ; } export function isScenarioAction ( action ) { return ( action && action . actionId && action . headActionIds ) ; } export interface NetworkedMeta { fromPeerId ? : string ; fromGM ? : boolean ; originPeerId ? : string ; } export interface NetworkedAction extends Action , NetworkedMeta { } export type NetworkedPayloadAction < T > = PayloadAction < T , string , NetworkedMeta & { peerKey : string ; } > ;