import type { CommunicationContractInterface } from "./interfaces"; import type { Pushable, Pullable, Subscribable, PollingProxy, Triggerable, Gate, AsyncPushable, AsyncPullable, AsyncPollingProxy, AsyncTriggerable, } from "./types"; /** * Type guard: narrows a transfer to `Pushable` when `isPushable` is true. * * @category Guards */ export function isPushable(contract: CommunicationContractInterface): contract is CommunicationContractInterface & Pushable { return contract.isPushable; } /** * Type guard: narrows a transfer to `Pullable` when `isPullable` is true. * * @category Guards */ export function isPullable(contract: CommunicationContractInterface): contract is CommunicationContractInterface & Pullable { return contract.isPullable; } /** * Type guard: narrows a transfer to `Subscribable` when `isSubscribable` is true. * * @category Guards */ export function isSubscribable(contract: CommunicationContractInterface): contract is CommunicationContractInterface & Subscribable { return contract.isSubscribable; } /** * Type guard: narrows a transfer to `PollingProxy` when `isPollingProxy` is true. * * @category Guards */ export function isPollingProxy(contract: CommunicationContractInterface): contract is CommunicationContractInterface & PollingProxy { return contract.isPollingProxy; } /** * Type guard: narrows a transfer to `Triggerable` when `isTriggerable` is true. * * @category Guards */ export function isTriggerable(contract: CommunicationContractInterface): contract is CommunicationContractInterface & Triggerable { return contract.isTriggerable; } /** * Type guard: narrows a transfer to `Gate` when `isGate` is true. * * @category Guards */ export function isGate(contract: CommunicationContractInterface): contract is CommunicationContractInterface & Gate { return contract.isGate; } /** * Type guard: narrows a transfer to `AsyncPushable` when `isAsyncPushable` is true. * * @category Guards */ export function isAsyncPushable(contract: CommunicationContractInterface): contract is CommunicationContractInterface & AsyncPushable { return contract.isAsyncPushable; } /** * Type guard: narrows a transfer to `AsyncPullable` when `isAsyncPullable` is true. * * @category Guards */ export function isAsyncPullable(contract: CommunicationContractInterface): contract is CommunicationContractInterface & AsyncPullable { return contract.isAsyncPullable; } /** * Type guard: narrows a transfer to `AsyncPollingProxy` when `isAsyncPollingProxy` is true. * * @category Guards */ export function isAsyncPollingProxy(contract: CommunicationContractInterface): contract is CommunicationContractInterface & AsyncPollingProxy { return contract.isAsyncPollingProxy; } /** * Type guard: narrows a transfer to `AsyncTriggerable` when `isAsyncTriggerable` is true. * * @category Guards */ export function isAsyncTriggerable(contract: CommunicationContractInterface): contract is CommunicationContractInterface & AsyncTriggerable { return contract.isAsyncTriggerable; }