Add suffix to Object keys with TypeScript?

Viewed 1015

In the context of Redux async actions, I need to pass in an object and retrieve each key with a some suffixes. Heres is an example:

const actions = createAsyncActions('MY_ACTIONS')

The function should use the input string as the main object key and the add suffixes to it, so the resulting type of actions is:

{
    MY_ACTIONS: string
    MY_ACTIONS_PENDING: string
    MY_ACTIONS_FULFILLED: string
    MY_ACTIONS_REJECTED: string
}
0 Answers
Related