Newbie into flow-type here. I have global type defined in a .js file and it resides in flow-typed folder under the root of my project.
// @flow
declare type MCUserID = number;
declare var mcuser: MCUserID;
And [libs] section my .flowconfig looks like below.
[libs]
flow-typed
But when I try to use mcUser in other modules in the project, I get error
ReferenceError: mcUser is not defined.
Am I missing some other configuration? Are the global variables cached somewhere ? I'm using VSCode on windows 7 for development. I read somewhere to restart flow server. I'm not sure how to do that on VSCode. I infact restarted my box and still this doesn't seem to recognize the global declarations.
You have to export your type and variable (in an object
{}), and then import (or require) them in the modules where you want to use them.