%dw 2.0
import * from dw::core::Types
type AType = {name: String} & {age: Number}
output application/json
---
{
a: intersectionItems(AType)
}
intersectionItems
intersectionItems(t: Type): Array<Type>
Returns an array of all the types that define a given Intersection type. This function fails if the input is not an Intersection type.
Introduced in DataWeave version 2.3.0.
Example
This example shows how intersectionItems
behaves with different inputs.
Note that the AType
variable defines an Intersection type
{name: String} & {age: Number}
by using an &
between
the two objects.