jsxInject is causing Typescript to get confused (ts7026)
bdombro opened this issue · 2 comments
bdombro commented
Because preset-vite injects import { h, Fragment } from 'preact', we cannot import it within our source files. This would be fine, except that Typescript is unaware that it's injected and throws an error (ts7026).
I propose we either trick Typescript (unsure how), or not inject { h, Fragment }.
Here is a patch produced by patch-package to disable the injection:
diff --git a/node_modules/@preact/preset-vite/dist/esm/index.mjs b/node_modules/@preact/preset-vite/dist/esm/index.mjs
index 1905485..e381003 100644
--- a/node_modules/@preact/preset-vite/dist/esm/index.mjs
+++ b/node_modules/@preact/preset-vite/dist/esm/index.mjs
@@ -11,7 +11,7 @@ export default function preactPlugin(_a) {
esbuild: {
jsxFactory: "h",
jsxFragment: "Fragment",
- jsxInject: "import { h, Fragment } from 'preact'"
+ // jsxInject: "import { h, Fragment } from 'preact'"
},
resolve: {
alias: {
bdombro commented
Nevermind, I'm an idiot. I made a mistake, please disregard issue.
marvinhagemeister commented
Nothing wrong with reporting this. It's related to #4