import { UpdateChannelParams } from '@statechannels/client-api-schema' ; type UpdateChannelRequest = { operation : 'UpdateChannel' ; args : UpdateChannelParams ; } ; type PushMessageRequest = { operation : 'PushMessage' ; args : unknown ; } ; type PushUpdateRequest = { operation : 'PushUpdate' ; args : unknown ; } ; export type StateChannelWorkerData = UpdateChannelRequest | PushMessageRequest | PushUpdateRequest ; export function isStateChannelWorkerData ( data ) { return ( 'operation' in data && ( data . operation === 'UpdateChannel' || data . operation === 'PushMessage' ) ) ; } const guard = < T extends StateChannelWorkerData > ( operation ) => ( data ) : data is T => isStateChannelWorkerData ( data ) && data . operation === operation ; export const isUpdateChannelRequest = guard < UpdateChannelRequest > ( 'UpdateChannel' ) ; export const isPushMessageRequest = guard < PushMessageRequest > ( 'PushMessage' ) ;