<commit_before>import {
  Pattern, Effect,
  TakeEffectDescriptor, ChannelTakeEffectDescriptor,
  PutEffectDescriptor, ChannelPutEffectDescriptor,
  AllEffectDescriptor, RaceEffectDescriptor,
  CallEffectDescriptor, ForkEffectDescriptor,
  JoinEffectDescriptor, CancelEffectDescriptor,
  SelectEffectDescriptor, ActionChannelEffectDescriptor,
  CancelledEffectDescriptor, FlushEffectDescriptor,
  GetContextEffectDescriptor, SetContextEffectDescriptor,
} from "./effects";
import {Task, Channel, Buffer, SagaIterator} from "./index";


export const TASK: string;
export const SAGA_ACTION: symbol;

export function noop(): void;

export type GuardPredicate<T> = (arg: any) => arg is T;

export const is: {
  undef: GuardPredicate<undefined>;
  notUndef: GuardPredicate<any>;
  func: GuardPredicate<Function>;
  number: GuardPredicate<number>;
  string: GuardPredicate<string>;
  array: GuardPredicate<Array<any>>;
  object: GuardPredicate<object>;
  promise: GuardPredicate<Promise<any>>;
  iterator: GuardPredicate<Iterator<any>>;
  iterable: GuardPredicate<Iterable<any>>;
  task: GuardPredicate<Task>;
  observable: GuardPredicate<{subscribe: Function}>;
  buffer: GuardPredicate<Buffer<any>>;
  pattern: GuardPredicate<Pattern>;
  channel: GuardPredicate<Channel<any>>;
  helper: GuardPredicate<SagaIterator>;
  stringableFunc: GuardPredicate<Function>;
};

interface Deferred<R> {
  resolve(result: R): void;
  reject(error: any): void;
  promise: Promise<R>;
}

export function deferred<T, R>(props?: T): T & Deferred<R>;

export function arrayOfDeffered<T>(length: number): Deferred<T>[];

interface MockTask extends Task {
  setRunning(running: boolean): void;
  setResult(result: any): void;
  setError(error: any): void;
}

export function createMockTask(): MockTask;

export const asEffect: {
  take(effect: Effect):
    undefined | TakeEffectDescriptor | ChannelTakeEffectDescriptor<any>;
  put(effect: Effect):
    undefined | PutEffectDescriptor<any> | ChannelPutEffectDescriptor<any>;
  all(effect: Effect): undefined | AllEffectDescriptor;
  race(effect: Effect): undefined | RaceEffectDescriptor;
  call(effect: Effect): undefined | CallEffectDescriptor;
  cps(effect: Effect): undefined | CallEffectDescriptor;
  fork(effect: Effect): undefined | ForkEffectDescriptor;
  join(effect: Effect): undefined | JoinEffectDescriptor;
  cancel(effect: Effect): undefined | CancelEffectDescriptor;
  select(effect: Effect): undefined | SelectEffectDescriptor;
  actionChannel(effect: Effect): undefined | ActionChannelEffectDescriptor;
  cancelled(effect: Effect): undefined | CancelledEffectDescriptor;<commit_msg>TypeScript: update utils<commit_after>import {
  Pattern, Effect,
  TakeEffectDescriptor, ChannelTakeEffectDescriptor,
  PutEffectDescriptor, ChannelPutEffectDescriptor,
  AllEffectDescriptor, RaceEffectDescriptor,
  CallEffectDescriptor, ForkEffectDescriptor,
  JoinEffectDescriptor, CancelEffectDescriptor,
  SelectEffectDescriptor, ActionChannelEffectDescriptor,
  CancelledEffectDescriptor, FlushEffectDescriptor,
  GetContextEffectDescriptor, SetContextEffectDescriptor,
} from "./effects";
import {Task, Channel, Buffer, SagaIterator} from "./index";


export const TASK: string | symbol;
export const SAGA_ACTION: string | symbol;

export function noop(): void;

export type GuardPredicate<T> = (arg: any) => arg is T;

export const is: {
  undef: GuardPredicate<undefined>;
  notUndef: GuardPredicate<any>;
  func: GuardPredicate<Function>;
  number: GuardPredicate<number>;
  string: GuardPredicate<string>;
  array: GuardPredicate<Array<any>>;
  object: GuardPredicate<object>;
  promise: GuardPredicate<Promise<any>>;
  iterator: GuardPredicate<Iterator<any>>;
  iterable: GuardPredicate<Iterable<any>>;
  task: GuardPredicate<Task>;
  observable: GuardPredicate<{subscribe: Function}>;
  buffer: GuardPredicate<Buffer<any>>;
  pattern: GuardPredicate<Pattern>;
  channel: GuardPredicate<Channel<any>>;
  helper: GuardPredicate<SagaIterator>;
  stringableFunc: GuardPredicate<Function>;
};

interface Deferred<R> {
  resolve(result: R): void;
  reject(error: any): void;
  promise: Promise<R>;
}

export function deferred<T, R>(props?: T): T & Deferred<R>;

export function arrayOfDeferred<T>(length: number): Deferred<T>[];

interface MockTask extends Task {
  setRunning(running: boolean): void;
  setResult(result: any): void;
  setError(error: any): void;
}

export function createMockTask(): MockTask;

export const asEffect: {
  take(effect: Effect):
    undefined | TakeEffectDescriptor | ChannelTakeEffectDescriptor<any>;
  put(effect: Effect):
    undefined | PutEffectDescriptor<any> | ChannelPutEffectDescriptor<any>;
  all(effect: Effect): undefined | AllEffectDescriptor;
  race(effect: Effect): undefined | RaceEffectDescriptor;
  call(effect: Effect): undefined | CallEffectDescriptor;
  cps(effect: Effect): undefined | CallEffectDescriptor;
  fork(effect: Effect): undefined | ForkEffectDescriptor;
  join(effect: Effect): undefined | JoinEffectDescriptor;
  cancel(effect: Effect): undefined | CancelEffectDescriptor;
  select(effect: Effect): undefined | SelectEffectDescriptor;
  actionChannel(effect: Effect): undefined | ActionChannelEffectDescriptor;
  cancelled(effect: Effect): undefined | CancelledEffectDescriptor;
{'fraction_non_alphanumeric': 0.10900473933649289, 'fraction_numerical': 0.0, 'mean_word_length': 7.308661417322835, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7501397', 'n_tokens_mistral': 1474, 'n_tokens_neox': 1472, 'n_words': 359}