import { Immutable } from './immutable';
/**
 * Immutable Array cannot be changed once created
 */
export declare class ImmutableArray<T> implements Immutable<T[]> {
  length: number;
  private readonly array;
  /**
   * The constructor of ImmutableArray
   *
   * @typedef T generic type parameter
   * @param {T[]} initialArray - Optional initial array
   * @param {() => void} onMutate - Optional callback invoked with the new ImmutableArray whenever a mutation is performed
   */
  constructor(initialArray?: T[], onMutate?: (newArr: ImmutableArray<T>) => void);
  /**
   * The function is called when the array is mutated
   *
   * @typedef T generic type parameter
   * @param {ImmutableArray<T>} _newArr - The new array that was created.
   */
  onMutate(_newArr: ImmutableArray<T>): void;
  /**
   * Append items to the array and return a new ImmutableArray
   *
   * @param {T[]} items - The items to be appended to the array
   * @returns {ImmutableArray<T>} - a new ImmutableArray with new items pushed.
   */
  push(...items: T[]): ImmutableArray<T>;
  /**
   * Remove the last item from the array and return a new ImmutableArray.
   * If the array is empty, a new ImmutableArray with the same (empty) contents is returned.
   *
   * @returns {ImmutableArray<T>} - a new ImmutableArray with the last one popped
   */
  pop(): ImmutableArray<T>;
  /**
   * Update the item at the specified index and return a new ImmutableArray.
   * If the index is out of range, no change is made and a new ImmutableArray (same contents) is returned.
   *
   * @param {number} index - Index of the item to update.
   * @param {T} value - New value to set at the given index.
   * @returns {ImmutableArray<T>} - a new ImmutableArray with updated item.
   */
  set(index: number, value: T): ImmutableArray<T>;
  /**
   * Set values from the provided array into this ImmutableArray one by one
   *
   * @param {T[]} values - Array of values to write into this array.
   * @returns {ImmutableArray<T>} - a new ImmutableArray with updated items.
   */
  setAll(values: T[]): ImmutableArray<T>;
  /**
   * Clear the array and return a new ImmutableArray
   *
   * @returns {ImmutableArray<T>} return a new ImmutableArray.
   */
  clear(): ImmutableArray<T>;
  /**
   * Performs a mutation on a copy of the internal array and returns a new ImmutableArray
   *
   * @param {(arr: T[]) => void} fn - (arr: T[]) => void
   * @returns {ImmutableArray<T>} A new ImmutableArray
   */
  withMutation(fn: (arr: T[]) => void): ImmutableArray<T>;
  /**
   * Get item by index
   *
   * @param {number} index - index of the array items
   * @returns {T | undefined} The array item with the index
   */
  get(index: number): T | undefined;
  /**
   * Join array elements into a string separated by the given separator.
   *
   * @param {string} [separator=','] - Separator to use between elements.
   * @returns {string} The joined string.
   */
  join(separator?: string): string;
  /**
   * It returns an array of the values in the array
   *
   * @returns {T[]} An array of the values in the array.
   */
  toArray(): T[];
}
