-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Improve type infererence for fromJS #1927
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
Conversation
Thanks @KSXGitHub, I will release this next week probably. |
This has been released in 4.2.4. Thanks ! |
@@ -5160,12 +5160,39 @@ declare namespace Immutable { | |||
*/ | |||
function fromJS( | |||
jsValue: unknown, | |||
reviver?: ( | |||
reviver: ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No way this is correct - I never had problems skipping this argument in runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @ntucker . That's an overload for the definition right after. It does say :
- if the reviver method is set, then the return type is
Collection<unknown, unknown>
- if the reviver is not set of undefined, then we can calculate the return type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may very well be a bug with typescript, but I'm fairly certain you'd still be interested in supporting typescript versions less than 5.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's continue in #1935 to avoid multiplying conversation in different threads
Originally from KSXGitHub in #1617