Right now there is no good way to write types inside bodies declare module {}that are not exported, so it’s best to put the declaration outside declare module {}and reference it.
To prevent names from matching, this is a convention to put something like $npm$ModuleName$before the name type / var.
Reference: flow-typedWRITING NOTES
source
share