-
Notifications
You must be signed in to change notification settings - Fork 12.8k
After upgrading from 4.8.2 to 4.9.4, the type extension of third-party libraries becomes invalid. #55518
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
Comments
Is this even a legal declaration? I didn't think you could specialize generics like this. |
When my typescript version is 4.8.x, this declaration is indeed valid. This is just an example used to distinguish the differences between 4.8.x and 4.9.x. I wouldn't write it like this in a real project. I mainly want to know what changes in 4.9.x would cause such differences. |
The declaration is not valid in any TS version, but that doesn’t stop it from being used. What changed is that in 4.8, we completely overwrite But yeah, this is working as intended, and the behavior in 4.8 was a bug, sorry 😕 |
So can't I expand the type of useSelector in react-redux now? Or is there another way to write it? |
You did expand it; you added an overload. But your overload has the same arity as the other overloads and gets added to the end of the overload list, so it isn’t selected when you call the function. |
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
🔎 Search Terms
🕗 Version & Regression Information
There was no such issue in 4.8.4, but it was found that the extension of d.ts became invalid from 4.9.1-rc onwards, and this issue persists in subsequent versions.
⏯ Playground Link
No response
💻 Code
🙁 Actual behavior
The type definition used by useSelector is still from react-redux internally.
🙂 Expected behavior
useSelector uses the types defined in my d.ts file. Just like it performed in 4.8.4
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: