We import #core/dom/jsx under the Preact namespace:
import * as Preact from '#core/dom/jsx';
We should use @jsx with a namespace other than Preact since it's misleading:
#36640 (comment)
Nit: I'm a bit worried we'll confuse this with actual Preact (and the ability to diff). Can we use a different name and @jsxPragma?
// input
/** @jsx StaticTree.createElement */
<div/>
// output
StaticTree.createElement("div");
Closure does not play nice with the @jsx annotation:
WARNING - [JSC_BAD_JSDOC_ANNOTATION] Parse error. illegal use of unknown JSDoc tag "jsx"; ignoring it.
Place another character before the @ to stop JSCompiler from parsing it as an annotation.
If we ever figure this out, or move away from Closure (#35264), we should:
- Replace all uses with
JsxStaticTree
- Update
local/preact lint rule so that it allows namespaces other than Preact. (It would be convenient if namespace has to start withJsx)
We import
#core/dom/jsxunder thePreactnamespace:We should use
@jsxwith a namespace other thanPreactsince it's misleading:Closure does not play nice with the
@jsxannotation:If we ever figure this out, or move away from Closure (#35264), we should:
JsxStaticTreelocal/preactlint rule so that it allows namespaces other thanPreact. (It would be convenient if namespace has to start withJsx)