Closed eostrom closed 2 years ago
The solution for me was to change the jsx
property in tsconfig.json
and add jsxImportSource
:
"jsx": "react-jsx",
"jsxImportSource": "preact",
I'm not sure where the initial tsconfig.json
file came from or how to make this change for Preact projects only, but if you point me in the right direction I'd be happy to try to provide a PR.
Hi Erik!
Thanks for sharing! I'll add the proper tsconfig.json to the preact template in create-iles
.
I'll keep this issue open as a reminder in the meantime.
Fixed in create-iles@0.6.2
. Thanks @eostrom!
iles
andvite
.Description ๐
In a new รฎles app with Preact, I tried creating a component with TypeScript, and got a TypeScript error:
(See full output below.)
Reproduction ๐
eostrom/iles-preact-typescript-repro
Dependencies Info
``` โฏ npx iles info iles v0.6.4 vite v2.6.14 โฏ npm list iles-app@0.0.0 /Users/eostrom/workspace/swagleft/iles-preact-typescript-repro โโโ @preact/preset-vite@2.1.5 โโโ iles@0.6.4 โโโ preact-render-to-string@5.1.19 โโโ preact@10.5.15 โโโ typescript@4.3.5 โโโ vite@2.6.14 โโโ vue-tsc@0.3.0 ```Logs ๐
Output
`npm run dev` and `build` work, but my IDE shows the errors produced by `yarn tsc --noEmit`: ``` src/components/FrameworkLink.tsx:4:3 - error TS2322: Type 'Element' is not assignable to type 'VNode{ ~~~~~~~~~~~~~~~~~ The expected type comes from the return type of this signature. Found 1 error. ```