Skip to content
This repository was archived by the owner on Dec 26, 2017. It is now read-only.

Fix error with lift method#163

Merged
brandonroberts merged 1 commit intongrx:masterfrom
smac89:patch-1
Jul 5, 2017
Merged

Fix error with lift method#163
brandonroberts merged 1 commit intongrx:masterfrom
smac89:patch-1

Conversation

@smac89
Copy link
Copy Markdown
Contributor

@smac89 smac89 commented Jun 30, 2017

fixes #161

The error was:

Class 'Actions' incorrectly extends base class 'Observable<Action>'.
  Types of property 'lift' are incompatible.
    Type '(operator: Operator<any, Action>) => Observable<Action>' is not assignable to type '<R>(operator: Operator<Action, R>) => Observable<R>'.
      Types of parameters 'operator' and 'operator' are incompatible.
        Type 'Operator<Action, R>' is not assignable to type 'Operator<any, Action>'.
          Type 'R' is not assignable to type 'Action'.

fixes #161

The error was:
```log
Class 'Actions' incorrectly extends base class 'Observable<Action>'.
  Types of property 'lift' are incompatible.
    Type '(operator: Operator<any, Action>) => Observable<Action>' is not assignable to type '<R>(operator: Operator<Action, R>) => Observable<R>'.
      Types of parameters 'operator' and 'operator' are incompatible.
        Type 'Operator<Action, R>' is not assignable to type 'Operator<any, Action>'.
          Type 'R' is not assignable to type 'Action'.
```
@smac89
Copy link
Copy Markdown
Contributor Author

smac89 commented Jun 30, 2017

There is another error I noticed, but I think this has more to do with rxjs and specifically typescript 5.4.1:

Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
  Types of property 'lift' are incompatible.
    Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
      Type 'Observable<T>' is not assignable to type 'Observable<R>'.
        Type 'T' is not assignable to type 'R'.

This can be fixed by adding "noStrictGenericChecks": true, to tsconfig. Thanks to this helpful hint

@rernens
Copy link
Copy Markdown

rernens commented Jul 4, 2017

@smac89

rather than using « noStrictGenericChecks: true » which is not recommended, until rxjs is fixed create a file in in your project and paste into it the following code. It will be picked by the compiler and will fix the issue.

// augmentations.ts
import {Operator} from 'rxjs/Operator';
import {Observable} from 'rxjs/Observable';

declare module 'rxjs/Subject' {
  interface Subject<T> {
    lift<R>(operator: Operator<T, R>): Observable<R>;
  }
}

waiting for your fix to be included in @ngrx/effects to address the first issue.

Thanks

@isaacplmann
Copy link
Copy Markdown

@brandonroberts @MikeRyanDev Please merge this PR so that @ngrx/effects can work with Typescript 2.4.1+. rxjs fixed their issue last night. This PR would make it so that you don't need any workarounds any more.

@rernens
Copy link
Copy Markdown

rernens commented Jul 5, 2017

@smac89 @isaacplmann

I confirm that rxjs 5.4.2 fixes the issue on their part.

your fix need to be merged !

@brandonroberts brandonroberts merged commit d264b4f into ngrx:master Jul 5, 2017
@isaacplmann
Copy link
Copy Markdown

isaacplmann commented Jul 5, 2017 via email

@rernens
Copy link
Copy Markdown

rernens commented Jul 6, 2017

@brandonroberts @MikeRyanDev

thanks for merging this.

Any idea when npm will reflect it ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants