Flow: $Values for tuple (array) type

Reading Time: < 1 minute

With the flow, we have convenient way to check does value has the same type as value sof the object type, by using $Values:

Open Flow Try playground

What if we would need to do something similar, but for the tuple type?

If to look up available utility types it might look, that there is no way to do so, and if we want to have the type, that will describe the intersection of all value types, we would need to do it manually. However with using $ElementType we can do this:

Open Flow Try playground

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Olena Sovyn
Senior Software Engineer (London, UK). I ❤ React, Redux, lodash, React Storybook, and functional programming overall. Always open for learning something new

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Spelling error report

The following text will be sent to our editors: