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

Upgrading from 5.3.0 to 5.4.0 breaks TS compilation #2659

Closed
0x-r4bbit opened this issue Jun 13, 2017 · 3 comments
Closed

Upgrading from 5.3.0 to 5.4.0 breaks TS compilation #2659

0x-r4bbit opened this issue Jun 13, 2017 · 3 comments

Comments

@0x-r4bbit
Copy link

0x-r4bbit commented Jun 13, 2017

Hi everyone,

I ran into a regression when upgrading from RxJS 5.3.0 to 5.4.0 in my Angular project. Basically, I have a class that looks like:

export class LabResolver implements Resolve<Lab> {

  resolve(route: ActivatedRouteSnapshot): Observable<Lab> {
    ...
  }
}

Regardless of what this class does, this compiled perfectly with 5.3.0. When I upgrade to 5.4.0 I'm getting the following TS error:

Class 'LabResolver' incorrectly implements interface 'Resolve<Lab>'.
  Types of property 'resolve' are incompatible.
    Type '(route: ActivatedRouteSnapshot) => Observable<Lab>' is not assignable to type '(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Lab | Observable<Lab> | Promise<Lab>'.
      Type 'Observable<Lab>' is not assignable to type 'Lab | Observable<Lab> | Promise<Lab>'.
        Type 'Observable<Lab>' is not assignable to type 'Promise<Lab>'.
          Property 'then' is missing in type 'Observable<Lab>'.

I looked into the changelog to see if there's anything that might be related. The only thing I could think of was ade1fd5, however this is just me speculating here.

Maybe another important information: This basically happens in all "resolver" classes. Apart from resolvers being an Angular specific context, I think it boils down to the fact that a resolver's resolve() method always returns: any | Observable<any> | Promise<any>, where any is what ever you put into the Resolve generic.

I hope this is the right place to ask for help.

Thanks!

@0x-r4bbit
Copy link
Author

Copied from: Reactive-Extensions/RxJS#1485 (comment)

Quick update:

I double-checked if it has something to do with the TS version I'm using. I was on 2.2.2 upgraded to 2.3.4 but getting exactly the same errors.

I'm sure I'm missing something..

@0x-r4bbit
Copy link
Author

Okay, for unclear reasons, I can't reproduce this anymore. Sorry to bother everyone here. Closing.

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant