TS 4.0: jsxFragmentFactory ignored in Preact + TypeScript setup #39451
Labels
Bug
A bug in TypeScript
Domain: JSX/TSX
Relates to the JSX parser and emitter
Fix Available
A PR has been opened for this issue
Good First Issue
Well scoped, documented and has the green light
Milestone
I'm using the new
jsxFragmentFactory
to makeFragment
work in a Preact setup, but TypeScript won't recognize it.TypeScript Versions: 4.0.0-beta, 4.0.0-dev.20200706
Search Terms: JSX Fragment Factory, Preact
Code
Counter.tsx
tsconfig.json
See also:
Expected behavior: TypeScript recognizes that I use
<>...</>
as a shorthand for the importedFragment
Actual behavior:
With
"noUnusedLocals"
set to true, TypeScript throwserror TS6133: 'Fragment' is declared but its value is never read.
Playground Link: No playground, but a GitHub repo (https://github.com/ddprrt/preact-vite-ts-playground) -- this is a Vite setup that compiles, but I think this can be ignored for this issue. Editor feedback and running
tsc
show the actual behavior.Hope this helps!
The text was updated successfully, but these errors were encountered: