upgrade Show component - added prop checkObjectValues #2340
+80
−7
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.
First of all - this PR is open for discussion
Before adding changes, documentation, etc. I just wanted to get some feedback if this has a chance to be merged.
-- no breaking change --
Show will just behave as before when
checkObjectValues
is not set / true.Motivation: e.g.From Discord
Setting it to true will allow narrow the type of all values to NonNullable.
Imagine this case where you have a signal and store that relies in user input without initial values and you need to pass them to a child component which has strict non-null types.
With current Show typescript will complain that first and last might be undefined. So you either have to use the bang operator or use createMemo to narrow like
And pass it to Show which now correctly narrows to non-null types.
With the added prop you can just:
Summary
How did you test this change?