can't build Preact X + Typescript
See original GitHub issuehi everybody, I wanted to play a little bit with Preact X before official release, but I’m finding stuck with basic building of a Typescript template project.
steps to reproduce:
$ npm i -g preact-cli@next
$ preact create typescript x-test
$ cd x-test
$ npm i -D preact-cli@next @types/react
$ npm i preact@next preact-router@next
$ npm run build
and I get the following errors (at 95% of build 😭):
✖ ERROR ./node_modules/preact-router/index.d.ts
ERROR in ./node_modules/preact-router/index.d.ts(65,62):
TS2694: Namespace 'global.JSX' has no exported member 'HTMLAttributes'.
✖ ERROR ./node_modules/preact-router/match.d.ts
ERROR in ./node_modules/preact-router/match.d.ts(9,40):
TS2694: Namespace 'global.JSX' has no exported member 'HTMLAttributes'.
✖ ERROR ./src/components/header/index.tsx
ERROR in ./src/components/header/index.tsx(11,22):
TS2322: Type '{ children: string; activeClassName: string; href: string; }' is not assignable to type 'LinkProps'.
Property 'children' does not exist on type 'LinkProps'.
✖ ERROR ./src/components/header/index.tsx
ERROR in ./src/components/header/index.tsx(14,22):
TS2322: Type '{ children: string; activeClassName: string; href: string; }' is not assignable to type 'LinkProps'.
Property 'children' does not exist on type 'LinkProps'.
✖ ERROR ./src/components/header/index.tsx
ERROR in ./src/components/header/index.tsx(17,22):
TS2322: Type '{ children: string; activeClassName: string; href: string; }' is not assignable to type 'LinkProps'.
Property 'children' does not exist on type 'LinkProps'.
✖ ERROR undefined
running npm start
is fine, the project is built and can be opened in the browser, is only the build command that it’s breaking.
I’ve figured out reading other issues how to “upgrade” to Preact X, I didn’t found any documentation or note about it in repo or website, so maybe I’m missing something.
Any feedback is appreciated, thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
TypeScript
Preact has built-in TypeScript support. Learn how to make use of it! ... TypeScript includes a full-fledged JSX compiler that you can use...
Read more >Hello World with Preact, JSX & Typescript
In this tutorial we're going to setup the bare minimum needed to use Preact with Typescript. No Hot-Module-Reloading or complicated Webpack ...
Read more >Building a React.js app with Preact in TypeScript ... - YouTube
Let's build a simple React.js application using the Preact library along with Snowpack & Tailwind CSS, all in TypeScript nicely wrap ...
Read more >Preact + TypeScript won't allow me to directly call the h ...
It says: Cannot invoke an expression whose type lacks a call signature. Type 'typeof h' has no compatible call signatures.
Read more >How to use Web Components in Preact and TypeScript
TypeScript cannot type check our TSX template due to it not knowing the CustomElement class reference for our custom element tag. We can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FYI: we cut a new release for
preact-router
These have all been fixed in the master branch of preact router, but there has not been a new release since I believe.
Related PR