π 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
π 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
Workbench Repro
π Actual behavior
π Expected behavior
elementis used in the generated output so should not be found as unused.Generated output:
Additional information about the issue
Using pragmas instead of tsconfig works as expected so hopefully it's not a big gap to align these
Workbench Repro