Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · XO1509

Docs

XO1509: embed used outside a typed constant

error · reported by the checker

Files are embedded at build time, so embed is only a constant’s whole initializer, the constant declares its type (Str, Bytes, or embed.Dir), and the path is one string literal without interpolation. A module that declares its own embed uses it instead.

Example

const PAGE = embed("index.html")

Fix

Declare the type: `const PAGE: Str = embed("index.html")`.

Run xo explain XO1509 for this text in a terminal, or see section 10.6 of the specification.