facebook/relay

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

Open

#1,758 创建于 2017年5月15日

在 GitHub 查看
 (23 评论) (31 反应) (0 负责人)Rust (18,930 star) (1,874 fork)batch import
enhancementhelp wanted

描述

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.

贡献者指南