Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Add Payload type utility #173

Open
sanbornhilland opened this issue Jun 10, 2021 · 1 comment
Open

Add Payload type utility #173

sanbornhilland opened this issue Jun 10, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@sanbornhilland
Copy link

sanbornhilland commented Jun 10, 2021

Are you open to adding a Payload utility type? I think the following would be fairly useful:

const action = createActionCreator(
	'FOO',
	resolve => (foo: string) => resolve({ foo }),
)

// Get the payload type of this action
const FooPayload = Payload<typeof action>

Essentially I think you can do something like this but it would be better to make it generic.

type Payload = (ReturnType<typeof action>)['payload']
@the-dr-lazy the-dr-lazy added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jun 11, 2021
@the-dr-lazy the-dr-lazy added this to the v4.1.0 milestone Jun 11, 2021
@the-dr-lazy
Copy link
Owner

Sure. If anyone is interested in this, can submit a PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants