flow icon indicating copy to clipboard operation
flow copied to clipboard

Make it easier to add all definitions under a namespace

Open volkanunsal opened this issue 6 years ago • 1 comments

The current way of defining namespaced global type declarations is unnecessarily verbose. For example, defining React$Node, we have to use React$Node everywhere in the same definition file. This doesn't scale well for external libraries or standards, such as GeoJSON, that need to reference other types they also define.

TypeScript has a simple solution to this issue. Adding the following line at the top of the file places all declarations under the same namespace:

export as namespace GeoJSON;

This leads to clean and readable libdef files. Is it possible to add this feature to Flow?

volkanunsal avatar Feb 02 '19 13:02 volkanunsal

Coming from typescript this is a sorely missed feature.

andrewmclagan avatar May 11 '22 03:05 andrewmclagan