Error codesState

Code calls a method on a class instance in state

MARKLESS_STATE_CLASS_METHOD_CALLerrorMarkless raises it while it builds your .tsrx files.

The message

MARKLESS_STATE_CLASS_METHOD_CALL: `<callSource>` calls a method of the `<constructorName>` instance state "<stateName>" holds. Class instances in state are not supported yet, so Markless cannot see what the method changes and the page would not update.
state() crosses from the server to the browser as data, and a class instance's methods do not cross with it. A change a method makes through `this` is not a change Markless can record.
Keep the fields as plain data in "<stateName>" and turn the method into a function that takes the data, called as `update(<stateName>, ...)`; or build the <constructorName> inside this handler and write the fields you need back to state.
https://markless.dev/errors/MARKLESS_STATE_CLASS_METHOD_CALL

Words in angle brackets change from case to case.

Why

Markless cannot see what a method changes through this, so the page would not update, and a method named like a Map or Set method (add, set) is not treated as one. This comes with the refusal of the instance itself. What the build does not catch yet: an instance returned from a function or a static factory (state(makeCart()), Cart.create()), one nested in an array of arrays, inside an object in an array, behind a condition (ok ? new Cart() : null), as a Map value, under a computed key, made with Object.create, or assigned or pushed later in a handler (cart = new Cart(), carts.push(new Cart())). Those still build, then fail at server render or leave the page stale.

Fix

Turn the method into a function that takes the plain data, called as add(cart, 1), or build the instance inside the handler and write the fields you need back to state.

Where Markless raises it

All error codes

Button sounds are from Josh Comeau's Button Sounds library.