Create an Array from flow type?

104 Views Asked by At

I have a string type like this:

export type Event =
  | 'AttachmentAdded'
  | 'AttachmentRemoved'
  | 'FieldUpdate'
  | 'Pause'
  | 'ReferenceAdded'
  | 'StateTransition'
  | 'Unpause';

I want to write a condition that checks that a value matches one of these types:

UpdateEvent.includes(value)

However I don't want to create a new array called const UpdateEvent: Event = ["AttachementAdded", ...]

Is there a way to use the type to check value or do I have to duplicate that list of options?

0

There are 0 best solutions below