facebook / facebook/flow

String Enum concatenation

Open
#4,611 5 comments 3 reactions 0 assignees View on GitHub
feature request
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

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).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.