-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Investigate createAsyncThunk
type failures with TS 5.1+
#3758
Comments
I bisected the change to this diff so it's almost guaranteed that the change is caused by microsoft/TypeScript#52609 |
Oh lovely :) Don't think there's a good way for us to conditionally |
Ye, it might be tricky for u to handle this specific diff in ur test case. The bigger q is if this is a desired change or not? I think that likely it is intended on the TS side of things but i didnt actually analyze ur types to be sure |
I don't fully have the behavior here in my head, but it seems like the typetest worked fine as of TS 5.0, and broke with TS 5.1. So, that makes me assume that this is not a desired change. |
The PR in question started to consider some inference sources that were previously ignored. So it is expected that some scenarios could get affected. I’m unsure yet if this particular change is for good or not - i only looked at a playground that manifested the change but there was no error there. The inferred type was just different. Could u create a playground that would show the unintended behavior in a more direct way? |
here's a playground for what createAsyncThunk tries to do. Basically, when the payload creator's argument is optional (or possibly undefined) we want to mark the argument as optional in the resulting function. The new behaviour breaks our ability to infer that, because an optional parameter no longer infers as possibly undefined. |
Oh, ye - this looks wrong. Luckily... I already fixed this in microsoft/TypeScript#55397 . You can see that the nightly TS version doesn't suffer from this: TS playground |
Well, #3761 is my first use of https://github.com/phryneas/ts-version :) |
Bumped the TS versions to include 5.1 and 5.2, and got this:
https://github.com/reduxjs/redux-toolkit/actions/runs/6367491100/job/17286119923?pr=3757
The text was updated successfully, but these errors were encountered: