MARKLESS_STATE_OPTIONAL_CHAIN_WRITE
Code writes to state through optional chaining, like a?.b = 1.
Error from the compiler, while it builds your .tsrx files.
What happened
Optional chaining can skip a write when part of the path is missing. Markless needs every write to have a definite target.
Markless prints the message, the reason, and a suggestion:
MARKLESS_STATE_OPTIONAL_CHAIN_WRITE: Cannot write to "<target>" through optional chaining because graph writes must have definite targets.
Optional chaining can skip the method call and its arguments at runtime. The current graph write artifact cannot preserve that short-circuit behavior safely across resume.
Guard explicitly before mutating graph state, or initialize the state path so the collection method call always has a definite target.
https://markless.dev/errors/MARKLESS_STATE_OPTIONAL_CHAIN_WRITE
Words in angle brackets change from case to case.
How to fix it
Check the value with an if before you write. Or give the state a start value so the path always exists.
Where it comes from
@markless/compiler raises this code. Source:
Read how to read a Markless error, or go back to all error codes.
