-
-
Notifications
You must be signed in to change notification settings - Fork 924
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
Support spreading null
or undefined
props
#958
Comments
Now I found this weird. I've been using TS for more than 3 years and I just learned this just now (since TS wouldn't allow you do this). I'm okay with supporting this but this just kind of felt weird for me 😂 |
Maybe you've been using TS too much. 😉 It's part of ECMAScript (also in In the context of Solid, suppose you have an optional prop |
@ryansolid Please excuse me if I'm misunderstanding. I think 5292c2d didn't handle spreading component props. |
@tienpv222 the commit was made in the compiler: ryansolid/dom-expressions@a8fc08c |
- `createComponent` passes an empty object instead of non-object props which are spread - `mergeProps` treats non-object sources as empty objects - added tests fixes solidjs#958
- `createComponent` passes an empty object instead of non-object props which are spread - `mergeProps` treats non-object sources as empty objects - added tests fixes solidjs#958
Yeah i missed looking at mergeProps in Solid. We can add additional checks. |
- `createComponent` passes an empty object instead of nullable props which are spread - `mergeProps` treats nullable sources as empty objects - added tests fixes solidjs#958
- `createComponent` passes an empty object instead of non-object props which are spread - `mergeProps` treats non-object sources as empty objects - added tests fixes solidjs#958
- `createComponent` passes an empty object instead of non-object props which are spread - `mergeProps` treats non-object sources as empty objects - added tests fixes solidjs#958
- `createComponent` passes an empty object instead of non-object props which are spread - `mergeProps` treats non-object sources as empty objects - added tests fixes #958
Describe the bug
Spreading
null
orundefined
props gives runtime errors.While it is not exactly the same, such situation is usually supported in places like plain object or
React
. It might be nice ifSolid
provides similar behavior.Additional consideration: support full native spreading JS object with
boolean
,number
, etc. ?Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
N/A
Expected behavior
Spreading
null
orundefined
props shouldn't throw exceptions.Screenshots or Videos
No response
Platform
N/A
Additional context
Related discussions:
The text was updated successfully, but these errors were encountered: