Should this be an RFC?
Which package is this a feature request for?
Lit Core (lit / lit-html / lit-element / reactive-element)
Description
It's easy to accidentally use the wrong html tagged template literal when reaching for static directives.
E.g.
import { html, render } from 'lit'; // This should be the html imported from 'lit/static-html.js'
import { unsafeStatic } from 'lit/static-html.js';
// Does not throw warning/error, and renders `attribute="[object Object]"`
render(html`<h1 attribute="${unsafeStatic('test')}">test</h1>`, document.body);
The above example ends up rendering attribute="[object Object]", when it should throw a dev mode warning.
Alternatives and Workarounds
Correctly use html TTL imported from static when using static values in your template.
E.g.
import { render } from 'lit'; // This should be the html imported from 'lit/static-html.js'
import { html, unsafeStatic } from 'lit/static-html.js';
// Renders correctly.
render(html`<h1 attribute="${unsafeStatic('test')}">test</h1>`, document.body);
Should this be an RFC?
Which package is this a feature request for?
Lit Core (lit / lit-html / lit-element / reactive-element)
Description
It's easy to accidentally use the wrong
htmltagged template literal when reaching for static directives.E.g.
The above example ends up rendering
attribute="[object Object]", when it should throw a dev mode warning.Alternatives and Workarounds
Correctly use
htmlTTL imported from static when using static values in your template.E.g.