Contact Us 1-800-596-4880

intersectionItems

intersectionItems(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 2.3.0. Supported by Mule 4.3 and later.

Parameters

Name Description

t

The type to check.

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.

Source

%dw 2.0
import * from dw::core::Types
type AType = {name: String} & {age: Number}
output application/json
---
{
   a: intersectionItems(AType)
}

Output

{
  "a": ["Object","Object"]
}