Error codesEvents

eval() reads the component’s names

MARKLESS_DIRECT_EVAL_UNSUPPORTEDerrorMarkless raises it while it builds your .tsrx files.

The message

MARKLESS_DIRECT_EVAL_UNSUPPORTED: `eval` in `<componentName>` runs code that reads `<named>`, but handlers and render code run in their own modules, where `<named>` is not defined.
The compiler moves handlers and derived values into separate modules and rewrites every read and write of state it can see in the source. Code inside an eval string is invisible to it, so it would throw a ReferenceError or change state without updating the page.
Write the code directly (before: `eval('count++')`, after: `count++`). To run code that only needs globals, call `new Function(code)()` or `(0, eval)(code)` instead.
MARKLESS_DIRECT_EVAL_UNSUPPORTED: `eval` in `<componentName>` runs code the compiler cannot read, so it cannot tell whether that code needs this component's names; handlers and render code run in their own modules, where those names are not defined.
The compiler moves handlers and derived values into separate modules and rewrites every read and write of state it can see in the source. Code inside an eval string is invisible to it, so it would throw a ReferenceError or change state without updating the page.
Write the code directly (before: `eval('count++')`, after: `count++`). To run code that only needs globals, call `new Function(code)()` or `(0, eval)(code)` instead.
https://markless.dev/errors/MARKLESS_DIRECT_EVAL_UNSUPPORTED

Words in angle brackets change from case to case.

Why

Markless moves handlers and derived values into their own modules, and rewrites each state read and write it sees in your code. It cannot see inside an eval string, and the names that string reads are not defined where the code runs.

Fix

Write the code directly: total++, not eval('total++'). For code that only needs globals, use new Function(code)() or (0, eval)(code).

Where Markless raises it

All error codes