facebook/relay

[Modern] Export Flow types from `relay-runtime`

Open

#1758 opened on May 15, 2017

View on GitHub
 (23 comments) (31 reactions) (0 assignees)Rust (18,930 stars) (1,874 forks)batch import
enhancementhelp wanted

Description

As things stand, the Flow types that the Relay compiler generates are unusable without a decent amount of fiddling to stub out the types they import, as documented in #1689.

The gist of it is that these generated files are trying to import various types from relay-runtime, but these types are not exported from those NPM packages. There are various ways to work around this, with the commonly accepted solution being to stub out the required types in a library definition, but these are far from ideal.

In my opinion, the ideal solution would be to include the Flow type definitions in the compiled NPM package. There's a few ways to go about this, from including the original sources alongside the Babel transpiled ones with the .js.flow extension, to including just the types in this with the still-experimental flow gen-flow-files command, but whatever the approach, including type definitions would be tremendously helpful.

Contributor guide