Pular para o conteúdo
TE734 · Tipos · error

`:global()` malformado — vazio ou aninhado

`:global(…)` isenta um compound do carimbo de escopo hermético. Um wrapper vazio (`:global()`) não isenta nada, e um aninhado (`:global(:global(a))`) escapa de um escape — os dois só podem ser engano. Num corpo `<style global>`, `:global()` nem é sintaxe Zolo e passa intacto.

Why this fires

:global(…) is the scoped sheet's escape hatch: the wrapped compound is emitted without the component stamp. Two shapes make no sense and are rejected:

  • Empty:global() { … } wraps nothing; there is no compound to exempt.
  • Nested:global(:global(a)) escapes an escape; the inner wrapper can only be a mistake.
fn Card() -> View {
    <div class="card">
        <style>:global() { margin: 0 }</style>
    </div>
}
// error[TE734]: malformed `:global()` — empty or nested

Fix it

Put exactly one selector (or compound chain) inside the wrapper:

<style>:global(body) { margin: 0 }
:global(.theme-dark) .card { background: black }</style>

If the whole block is global anyway, drop the wrappers and mark the tag instead: <style global>…</style>.

Inside a <style global> body :global(…) is not Zolo syntax at all — it passes through to the browser untouched, so this error only ever fires in scoped sheets.

See also

  • TE735 — selector matches no element of the component.
  • TE736<style> outside a component.

Veja também

Buscar no Zolo

9 resultados

en