transformListItem

List
stable

Convert one raw item (string or object) to a normalised IInternalListItem with resolved title, value, optional children array, itemProps, and the original raw reference.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

props
requis
Omit<IItemProps, 'items'> & { itemType?: string }
List props that control field extraction: `itemTitle`, `itemValue`, `itemChildren`, and `itemProps`.
item
requis
any
The raw item — a string or a plain object. Strings are used directly as the title; objects are walked by the `itemTitle`/`itemValue` path props.

API

Valeur de retour

La valeur retournée par cet util.

A normalised object with `title` (string), `value`, `props`, `children` (recursively transformed array or undefined), and `raw` (original item).

Usage

Exemples

Extraits de code prêts à coller.

Normalise a plain object item

typescript