Sorry it took long to reply!
Unfortunately, that is not going to work in my setup: I am dynamically importing Preact during the runtime, that is `getPreact()` returns Preact's exports. `jsxImportSource` implies automatic import, which is not going to work. I can, of course, use it to silence TypeScript and continue using ESBuild, which will actually use `h` defined in the scope, but then TypeScript starts to complain about ‘unused’ `h` declaration, while also not saying anything if I don't declare the `h` (duh).
I'd actually expect TypeScript to *not expect* that `h` can only come from the imports, but rather do what ESBuild does — use `h` defined within the scope; like in my situation — it is defined at the top of the file. Thus I filed it as a bug report, because it's an absolutely valid use case.
Also, I just noticed that I accidentally deleted CodeSandbox example, I re-wrote it here (will update in the issue body): [URL]