Type.ListItem
TypeReturns the item type of a list type.
Syntax
Type.ListItem(type as type) as typeParameters
| Name | Type | Required | Description |
|---|---|---|---|
type | type | Yes | A list type to extract the item type from. |
Return Value
type — The type of items contained in the list type.
Remarks
Type.ListItem extracts the element type from a list type. For example, given the type type {number} (a list of numbers), Type.ListItem returns type number.
This is useful in advanced scenarios involving type introspection, such as building generic functions that need to understand the structure of their inputs.
If the input is not a list type, the function raises an error.
Examples
Example 1: Extract item type from a list type
let
ListType = type {text},
ItemType = Type.ListItem(ListType),
IsText = Type.Is(ItemType, type text)
in
#table({"ListType", "ItemType IsText"}, {{"type {text}", IsText}})Result
ListType | ItemType IsText | |
|---|---|---|
| 1 | type {text} | TRUE |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks