jsxFactory import showing as unused when TSX is configured via tsconfig and only contains fragments
DRANK

🔎 Search Terms TSX unused fragment jsxFactory 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for entries about "jsx" ⏯ Playground Link https://www.typescriptlang.org/dev/bug-workbench/?noUnusedLocals=true&jsxFactory=element&jsxFragmentFactory=fragment#code/PTAEAECsGcA8C5QCcCmBDAxgFwFAgjLAGKZYD2SAnoigDYoC2KAdrvlHEUmgOZOslsFaqABm3PizZhwzMgFVmAV2goAJgBkyGNLWg48M0QEt6zNE0THmalLAB0WODmMMADhSygA3nUZSAGjEJfiwAX2CyBlAAcntgQhiAbgMMMmZoMnp7WjIeAAoAHgA+Ll5QwuBigEoUwwgTMwsUREJHfTsPJC9RJWZsY3TQP1D86p8wg07PMT6BofFyqTGJ0CA 💻 Code // @jsx: react // @jsxFactory: element // @jsxFragmentFactory: fragment // @noUnusedLocals // @filename: index.tsx import {element, fragment} from './jsx'; console.log(<>Fragment</>); // @filename: jsx.ts export function element() {} export function fragment() {} Workbench Repro 🙁 Actual behavior 'element' is declared but its value is never read. 🙂 Expected behavior element is used in the generated output so should not be found as unused. Generated output: console.log(element(fragment, null, "Fragment")); Additional information about the issue Using pragmas instead of tsconfig works as expected so hopefully it's not a big gap to align these // @jsx: react // @noUnusedLocals // @filename: index.tsx /** * @jsx element * @jsxFrag fragment */ import {element, fragment} from './jsx'; console.log(<>Fragment</>); // @filename: jsx.ts export function element() {} export function fragment() {} Workbench Repro

github.com
Related Topics: TypeScript
1 comments