Currently flow cannot infer that the result of string concatenation is a string enum value:
type command = 'go_in' | 'go_out' const com1: command = 'go_in' // OK const com2: command = 'go_' + 'in' // Error const createCommand = (dir: 'in' | 'out'): command => `go_${dir}` // Error
Demo
I'd say that while something like this is possible, it's out of scope of Flow.
Most helpful comment
I'd say that while something like this is possible, it's out of scope of Flow.