UNPKG

552 BTypeScriptView Raw
1import { IObservableArray } from "mobx";
2/**
3 * Moves an item from one position to another, checking that the indexes given are within bounds.
4 *
5 * @example
6 * const source = observable([1, 2, 3])
7 * moveItem(source, 0, 1)
8 * console.log(source.map(x => x)) // [2, 1, 3]
9 *
10 * @export
11 * @param {ObservableArray<T>} target
12 * @param {number} fromIndex
13 * @param {number} toIndex
14 * @returns {ObservableArray<T>}
15 */
16export declare function moveItem<T>(target: IObservableArray<T>, fromIndex: number, toIndex: number): IObservableArray<T> | undefined;