Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
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