You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the "?" Turnary operator a function in the "dead" branch is being executed when it shouldn't be.
Expected Behavior
Expected only the one (correct) path to be executed.
Current Behavior
constisTrue=something=>!!(something?.bob||something?.sally);constthrowsError=()=>{thrownewError("Should not be here!");};constmyFunction=()=>{returnisTrue() ? {my: "object",anotherParam: throwsError()} : "The only place we should be";};console.log(myFunction());
Hmm, this is a hard case to track.
Seems to find these cases we have to traverse up to all parent nodes of each ObjectExpression node until we found the host node of ObjectExpression. If we found ConditionalExpression or LogicalExpression node, then we have to traverse over ObjectExpression node and if we found CallExpression node, then this is our case.
But this is too many additional operations just to cover this case.
Also, we may add more simple logic - if ObjectExpression contains CallExpression node in any place - ignore transformation of this ObjectExpression. But this will ignore a huge amount of ObjectExpression nodes.
Using the "?" Turnary operator a function in the "dead" branch is being executed when it shouldn't be.
Expected Behavior
Expected only the one (correct) path to be executed.
Current Behavior
Throws error!
Steps to Reproduce
Expected string "the only place we should be" but getting exception "Should not be here!".
FYI: Without the transform-object-keys option it seems to be working fine.
Your Environment
The text was updated successfully, but these errors were encountered: