You are right, this code is no longer valid javascript. This means that when using Flow in someJavascriptFile.js, you must run a program that removes the stream code from someJavascriptFile.js, which is called transpiling. Which transpiler to use depends on how you run javascript and probably change over time, so I wonโt refer to any.
You can also wrap stream types in a comment, for example. var name /*:string*/ = "Hello flow." which is valid javascript but makes the code harder to read in my opinion.
In theory, Javascript engines might one day support parsing a stream, but thatโs a long time.
source share