Skip to content
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

TypeScript 3.8.3: type checking failing #188

Open
1 of 3 tasks
StefanJelner opened this issue Mar 19, 2020 · 9 comments
Open
1 of 3 tasks

TypeScript 3.8.3: type checking failing #188

StefanJelner opened this issue Mar 19, 2020 · 9 comments

Comments

@StefanJelner
Copy link

  • bug report
  • feature request
  • other (Please do not submit support requests here (below))

Description: When compiling Universal Router with Typescript 3.8.3 i get the following type checking errors:

[tsl] ERROR in foo/node_modules/universal-router/src/UniversalRouter.ts(207,13)
      TS2322: Type '{ done: false; value: false | RouteMatch<R, C>; }' is not assignable to type 'IteratorResult<RouteMatch<R, C>, false>'.
  Type '{ done: false; value: false | RouteMatch<R, C>; }' is not assignable to type 'IteratorReturnResult<false>'.
    Types of property 'done' are incompatible.
      Type 'false' is not assignable to type 'true'.
foo/node_modules/universal-router/src/UniversalRouter.ts
[tsl] ERROR in foo/node_modules/universal-router/src/UniversalRouter.ts(291,68)
      TS2339: Property 'route' does not exist on type 'false | RouteMatch<R, C>'.
  Property 'route' does not exist on type 'false'.
foo/node_modules/universal-router/src/UniversalRouter.ts
[tsl] ERROR in foo/node_modules/universal-router/src/UniversalRouter.ts(294,81)
      TS2339: Property 'route' does not exist on type 'false | RouteMatch<R, C>'.
  Property 'route' does not exist on type 'false'.
foo/node_modules/universal-router/src/UniversalRouter.ts
[tsl] ERROR in foo/node_modules/universal-router/src/UniversalRouter.ts(299,65)
      TS2339: Property 'route' does not exist on type 'false | RouteMatch<R, C>'.
  Property 'route' does not exist on type 'false'.
foo/node_modules/universal-router/src/UniversalRouter.ts
[tsl] ERROR in foo/node_modules/universal-router/src/UniversalRouter.ts(314,69)
      TS2339: Property 'params' does not exist on type 'false | RouteMatch<R, C>'.
  Property 'params' does not exist on type 'false'.

Solution: I already fixed it and attached a git diff to this bug report.
UniversalRouter.ts.txt

@frenzzy
Copy link
Member

frenzzy commented Mar 20, 2020

Can you please share the code how you are using it, for example how your routes looks like?

@StefanJelner
Copy link
Author

StefanJelner commented Mar 23, 2020

These errors are build errors, which are related to wrong or incomplete type declarations in your code, which have nothing to do with the way my routes look like. Please check the diff i made.

@frenzzy
Copy link
Member

frenzzy commented Mar 23, 2020

I do not have any type errors in my codebase and I am not sure you solution is correct.
Could you please share a minimal working example that I can reproduce the issue?

Maybe something wrong with tsconfig 🤷‍♂️

@StefanJelner
Copy link
Author

It worked until i updated your library. So it must have to do with changes you made in your library. It is easy to reproduce. Use Typescript 3.8.3 and import your library. Actually the errors should come up. Already in your IDE if you use VSC.

@frenzzy
Copy link
Member

frenzzy commented Mar 24, 2020

I just created a playground repo: https://github.com/frenzzy/universal-router-playground
There are no type errors, could you please tell me what I should change to reproduce the issue?

@frenzzy
Copy link
Member

frenzzy commented Mar 30, 2020

@StefanJelner any clue?

@GordonSmith
Copy link

GordonSmith commented Aug 15, 2020

@frenzzy reproduced example: frenzzy/universal-router-playground#1

(Apologies for the additional noise in the PR, it was cut and paste from a larger project).

The issue only presents itself after the generateUrls import is added...

@Lispython
Copy link

@frenzzy hi, I have the same problem with typescript 4.2.4 and I can confirm that bug appears after generateUrls import is added. Do you have any idea how to fix it?

@mbeckert
Copy link

mbeckert commented Oct 28, 2021

@frenzzy i'm experiencing the same problem with typescript 4.4.4, when importing generateUrls - any news?
@Lispython @GordonSmith @StefanJelner where you able to fix it in your project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants