Streamed-response use cases get weird/complicated if you have to return the response.
var name = "Jeff";
name = name.toUpperCase(); // safe
if (loggedOut) {
name = null; // safe
}
var firstInitial = name ? name[0] : null; // safe
The above code has no errors in it, and because flow infers `name` as a type `null | string`, Flow is able to verify its safety and thus doesn't error. var name: string = "Jeff";
name = name.toUpperCase();
if (loggedOut) {
name = null; // Error!
}
var firstInitial = name ? name[0] : null;
So in summary: Inference is the means by which Flow understands, annotations are the means by which you express to Flow your intentions.