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

fix #1605: create async thunk reject with value typing #1626

Closed

Conversation

loursbourg
Copy link
Contributor

This should fix the (now closed) issue #1605 without breaking the fix introduced after #1156.

@loursbourg loursbourg changed the title 1605 fix reject with value typing fix #1605: create async thunk reject with value typing Oct 20, 2021
@netlify
Copy link

netlify bot commented Oct 20, 2021

✔️ Deploy Preview for redux-starter-kit-docs ready!

🔨 Explore the source changes: 055036d

🔍 Inspect the deploy log: https://app.netlify.com/sites/redux-starter-kit-docs/deploys/616f612f609dad0008cc2325

😎 Browse the preview: https://deploy-preview-1626--redux-starter-kit-docs.netlify.app

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 055036d:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration
rsk-github-issues-example Configuration

@phryneas
Copy link
Member

phryneas commented Oct 20, 2021 via email

@phryneas
Copy link
Member

Yeah, as I had feared, unfortunately, this would allow the following test to pass, making it possible to return just any value from an async thunk with manual return type annotation:

createAsyncThunk<'ret', void>('test', async () => 5)

Can you think of other ways of doing this?

@phryneas
Copy link
Member

Also, the next closest thing, removing the | any you added will still allow for this:

createAsyncThunk<'ret', void, { fulfilledMeta: string }>(
    'test',
    async (_, api) => 'ret' as const
  )

So it will allow just returning the return type value without any fulfilledMeta specified, even though the types clearly state that it has to be there.

@phryneas
Copy link
Member

I think I have a solution over in #1644. Could you give that a try?

@loursbourg
Copy link
Contributor Author

I think I have a solution over in #1644. Could you give that a try?

I will.

@phryneas
Copy link
Member

Fixed with #1644

@phryneas phryneas closed this Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants