SyntaxFix
Write A Post
Hire A Developer
Questions
Using spread syntax with boolean (as suggested here) is not valid syntax. Spread can only be use with iterables.
I suggest the following:
const a = { ...(someCondition? {b: 5}: {} ) }