New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preact-router not compatible with history v5 #423
Comments
Well, types not lining up doesn't mean it's incompatible necessarily. Ideally they would, but TS type incompatibilities are pretty common in the ecosystem as a whole. Now, if you get runtime errors then absolutely. You might need to configure your
This is purely a result of your strict configuration; you can disable It does have types at
The error tells you exactly what the problem is: This is the same issue as #414, and maybe there's a disconnect here? Hash routers only work in a browser environment, therefore you cannot use them in Node, which You can get around this by dropping out of prerendering or using window checks (see https://github.com/preactjs/preact-cli#pre-rendering). However, without the router being available, there's likely little value in prerendering. |
You're right, this kind of type error sometimes occurs in the TypeScript ecosystem. However, it has been two years since the last release of the |
PRs welcome, but I'd push people to use |
Hey folks,
I'm on preact-router@4.0.1 and history@5.3.0 (both latest stable versions), and I'm running into similar / the same issues as reported in #385. I was looking around a bit and found #410 and #387 which claim to have solved the history v5 issue.
I have checked my package and package-lockfile to make sure the versions installed are the versions reported above.
Here is the use case and the error message, in case it helps
Workarounds I tried (and don't work)
Downgrading to history@4 does not work, because it doesn't seem to come with typescript types, and tsc type checking then fails.
Using history@5 with the workaround from Typescript hash router error #385 (comment) type-checks, but then at build time results in a very strange non-descriptive error message.
Any ideas what could be the cause of this? Curious if other folks successfully are using latest preact-router and history v5 with typyescript. Let me know if I can provide more information here.
The text was updated successfully, but these errors were encountered: