facebook / facebook/flow

String Enum concatenation

Aperta
#4,611 5 commenti 3 reazioni 0 assegnatari Vedi su GitHub
feature request
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi,
It would be great to be able to concat string enum type like
```js
type ActionTypes = {
fetch: 'FETCH_' + Name
}
typeof ActionTypes<'MY_NAME'> // { fetch: 'FETCH_MY_NAME' }

type Types = ActionTypes<'MY_NAME'>;
typeof $PropertyType; // 'FETCH_MY_NAME'
```

Is it conceivable ?

My use case is to be able to [generate redux action creators and keep strong typing and type refinement in the reducer](https://stackoverflow.com/questions/45697967/make-the-flow-type-refinement-works-in-a-reducer-for-generated-actions).

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.