import type { FunctionComponent } from "../dependencies/types"; import type { ErrorReport } from "./ErrorReport"; import type { ErrorReportValue } from "./ErrorReportValue"; import type { ItemAdder } from "./ItemAdder"; import type { ItemProps } from "./ItemProps"; import type { ItemRemover } from "./ItemRemover"; import type { NevoProps } from "./NevoProps"; /** * Returns the NEVO props for the item at the specified `itemIndex`. If `itemIndex` is not provided, returns the NEVO props for the entire array. * * @param itemIndex The index of the item for which to generate the props. */ export interface ItemCallable> { (itemIndex: number): ItemProps; (): NevoProps; /** * Returns an array that maps each item with an element out of `Component` with the NEVO props and optional extra props. * * @param Component * @param extraProps An object containing extra properties to add to each element, or a function that takes the items props and returns the extra properties to add. * @returns An array containing the produced elements out of `Component`. */ readonly loop:

( Component: FunctionComponent & P>, extraProps?: P | ((props: ItemProps) => P), ) => ReturnType & P>>[]; /** * Inserts an item at the specified index, shifting by one the previous item found at this index and its subsequent ones. * * @param item The item to add. * @param index The index where to add this item (defaults to the length of the array). */ readonly add: ItemAdder; /** * Removes the item found at the specified `index`. * * @param index The index of the item to remove. */ readonly remove: ItemRemover; /** * Retreives the item found at the specified `index`. * * @param index The index of the item to retreive, or `undefined` if none was found. */ readonly get: (index: number) => T | undefined; }