Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 946 Bytes

dw-types-functions-intersectionitems.adoc

File metadata and controls

53 lines (39 loc) · 946 Bytes

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.

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"]
}