hunk.code_window:   TAction extends BaseActionObject = BaseActionObject
   > {
     guard?: GuardConfig<TContext, TEvent>;
     actions?: BaseActions<TContext, TEvent, TAction>;
     internal?: boolean;
     target?: TransitionTarget<TContext, TEvent> | undefined;
     meta?: Record<string, any>;
     description?: string;
   }
  
hunk.labels: keep keep keep keep keep replace keep keep keep
hunk.after_edit:   target?: TransitionTarget | undefined;
  
hunk.file_path: packages/core/src/types.ts
hunk.type: replace
file: import { EventObject, ExprWithMeta, MachineContext } from '../types';
  import { cancel as cancelActionType } from '../actionTypes';
  import { isFunction } from '../utils';
  import {
    AnyInterpreter,
    BaseDynamicActionObject,
    CancelActionObject,
    DynamicCancelActionObject
  } from '..';
  import { createDynamicAction } from '../../actions/dynamicAction';
  
  /**
   * Cancels an in-flight `send(...)` action. A canceled sent action will not
   * be executed, nor will its event be sent, unless it has already been sent
   * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).
   *
   * @param sendId The `id` of the `send(...)` action to cancel.
   */
  
  export function cancel<
    TContext extends MachineContext,
    TEvent extends EventObject
  >(
    sendId: string | ExprWithMeta<TContext, TEvent, string>
  ): BaseDynamicActionObject<
    TContext,
    TEvent,
    CancelActionObject,
    DynamicCancelActionObject<TContext, TEvent>['params']
  > {
    return createDynamicAction(
      {
        type: cancelActionType,
        params: {
          sendId
        }
      },
      (_event, { state }) => {
        const resolvedSendId = isFunction(sendId)
          ? sendId(state.context, _event.data, {
              _event
            })
          : sendId;
  
        return [
          state,
          {
            type: 'xstate.cancel',
            params: {
              sendId: resolvedSendId
            },
            execute: (actorCtx) => {
              const interpreter = actorCtx.self as AnyInterpreter;
  
              interpreter.cancel(resolvedSendId);
            }
          } as CancelActionObject
        ];
      }
    );
  }
  