Files
reverse-engineering-anything/docs/guides/javascript
Pedro CormannandClaude Opus 5.5 abdf383939 fix(javascript): keep Electron options visible past conditional literal spreads (#9510)
* fix(javascript): keep Electron options visible past conditional literal spreads

The static object-literal model treated a spread such as
`...(isMac && { titleBarStyle: "hidden" })` or
`...(isMac ? { frame: false } : {})` as an unknown write, so every earlier
key became dynamic. BrowserWindow webPreferences and the preload association
were lost, and child-process options such as stdio lost their values too.

Expand `&&` and `?:` spreads whose branches are bounded literal copies into
one conditional-keys member. Only the keys a branch may copy stay
unresolved, and a falsy `&&` operand may still copy index keys
(document.all). `||`, `??`, unresolved branches, getters and computed keys
stay unknown, and nesting counts against the existing expression depth
limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(javascript): leave spread keys unknown after an unresolved && operand

A falsy `&&` operand is copied itself, and the conditional spread model
assumed it could add only index keys. document.all, the only falsy
object, can also carry expando properties with any key, so
`{ webPreferences, ...(isMac && { title: 1 }) }` reported the earlier
`webPreferences` as explicit while `isMac` was unresolved.

Bound the left operand with the same spread rules as a branch. A
comparison, `!` negation or other primitive result copies no named keys
and keeps earlier options readable; an unresolved operand, such as an
identifier, leaves the spread unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 18:18:03 +08:00
..