ud2U
Deno6mo ago
ud2

`@jsxRuntime` pragma

The TSConfig reference claims that adding a /* @jsxRuntime automatic */ comment to a file has the same effect as setting compilerOptions.jsx to "react-jsx" for that file, but this doesn't seem to be the case. I have a main.tsx file with the following content.
/* @jsxRuntime automatic */
/* @jsxImportSource npm:hastscript@9.0.1 */
console.log(<></>);

Without a config file, deno check main.tsx reports an error: “JSX element type '<>' does not have any construct or call signatures, but if I create a
deno.json
file with compilerOptions.jsx set (which I expected to do nothing because there's already a @jsxRuntime pragma), the error goes away.
{
  "compilerOptions": {
    "jsx": "react-jsx"
  }
}

Am I missing something, and is there a way to suppress this error without having to make a config file or adding a ignore comment?
Was this page helpful?