Skip to content
These are temporary community docs. The official docs are in progress.Help improve them
Markless
Esc
↑↓navigate↵open⌘Jpreview
On this page

MARKLESS_BRANCH_ELSE_SPELLING

An @if branch uses else without the @ sign.

Error from the compiler, while it builds your .tsrx files.

What happened

Without the @, the parser does not see a branch. The page shows the word “else” and the code after it as text.

Markless prints the message, the reason, and a suggestion:

MARKLESS_BRANCH_ELSE_SPELLING: This `else` follows an @if arm but is not written as `@else`, so it is not read as a branch at all. TSRX parses it as literal text next to the @if, and the block after it becomes a separate expression, so the page renders the word "else" followed by the arm's own source as escaped text.
Markless branches are spelled with the `@` sigil — `@if`, `@else if`, `@else` — because that sigil is what tells the parser a construct starts here. Without it the parser has no branch to attach the alternative to, and the mistake is silent: the module compiles and ships visible garbage instead of failing.
Write the alternative as `@else { ... }`.
https://markless.dev/errors/MARKLESS_BRANCH_ELSE_SPELLING

How to fix it

Write @else, with the @ sign.

@if (open) {
	<p>Open</p>
} @else {
	<p>Closed</p>
}

Where it comes from

@markless/compiler raises this code. Source:

Read how to read a Markless error, or go back to all error codes.

Was this page helpful?