question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can't build Preact X + Typescript

See original GitHub issue

hi 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
marvinhagemeistercommented, Jul 19, 2019

FYI: we cut a new release for preact-router

3reactions
pmkroekercommented, Jul 18, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found