Ensure all JSX spread properties get visited in ES2018+#55859
Ensure all JSX spread properties get visited in ES2018+#55859jakebailey merged 1 commit intomicrosoft:mainfrom
Conversation
| function transformJsxSpreadAttributeToProps(node: JsxSpreadAttribute) { | ||
| if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) { | ||
| return node.expression.properties; | ||
| return sameMap(node.expression.properties, p => Debug.checkDefined(visitNode(p, visitor, isObjectLiteralElementLike))); |
There was a problem hiding this comment.
This seems reasonable, but I can't help but notice that sameMap is never used in **/transformers/**, so I get a bad feeling that there's some other canonical method for doing this...
There was a problem hiding this comment.
Using this helper wasn't super intentional on my side. I just knew that there is such an util function and since this was returned as-is here before I decided to use it here (as they were returned as-is returning the same array shouldn't be the problem).
I can change this to a regular map though - the outcome would be the same.
There was a problem hiding this comment.
This does seem like the helper to use, I'm just surprised we haven't used it already...
|
@jakebailey This looks fine to me too. Should it go into 5.3? |
|
Probably, though the bot apparently forgot to update the PR and do the right assignment so I'd be happier if @rbuckton took a quick look. |
|
Actually, looking at how this is used, it's not like this is being passed to anything scary; it's always going to be flattened by |
fixes #55858