facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.38k stars 1.82k forks source link

Compiler: Flow Enums with Unknown Members instead of `"%future added value"` #3596

Open mrtnzlml opened 3 years ago

mrtnzlml commented 3 years ago

I've been reading through the new Flow Enums documentation and one thing that caught my attention was enums with unknown members. In short:

enum Status {
  Active,
  Paused,
  Off,
  ...
}

Specifically the last sentence:

One use case for this would be the JS output of GraphQL Enums: Flow Enums with unknown members could be used instead of the added '%future added value' member.

So my question/feature request is: are you considering this? Would you consider it?

Thanks! 😎

mrtnzlml commented 3 years ago
Screen Shot 2021-09-14 at 9 42 30

@gkz I've noticed that you just forked Relay. Is it related by any chance? 😊

gkz commented 2 years ago

https://github.com/facebook/relay/blob/4109d4ad3df42f5a486b5bd76fbf627942449ab8/compiler/crates/relay-config/src/typegen_config.rs#L51

mrtnzlml commented 2 years ago

@gkz Very cool! Does it work for OSS though? I am trying to use it but it seems like flow_enums is not being used anywhere in the OSS codebase. 🤔

Also: https://github.com/facebook/relay/commit/c3568ed7cb16ddd334a5dc9103d340fd51e3ac9a

mrtnzlml commented 2 years ago

@alunyov Is this a good candidate for https://github.com/facebook/relay/issues/3749? Is it a bug or a possible improvement? It seems like flow_enums option exists but doesn't do anything in OSS. 🤔