Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the course of writing
<SetEntries>
, I did a bit of digging on something I found confusing, resulting in this PR.I'm not sure why we need to check the parameter count of the
mapFn
:solid-primitives/packages/keyed/src/index.ts
Lines 230 to 237 in 71f6c5e
Without types for easier reading:
The
mapFn
is user-defined and may take 2 or 3 parameters. However, I believe that this is irrelevant and can be simplified toYou can see that in the following code, if you pass 3 arguments to a function that has 2 parameters, the 3rd argument is ignored:
Playground.
This demos what happens when the user gives us a fn with 2 parameters, but
solid-primitives
gives it 3 arguments.Relevant StackOverflow.
Perhaps I'm missing something obvious - I'm not super experienced with JS 😅