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

Types of property 'schedule' are incompatible #27

Closed
jafaircl opened this issue Aug 13, 2019 · 3 comments · Fixed by #28
Closed

Types of property 'schedule' are incompatible #27

jafaircl opened this issue Aug 13, 2019 · 3 comments · Fixed by #28
Labels

Comments

@jafaircl
Copy link

This is an awesome project and is making my life a lot easier. Thanks for putting it together.

I'm getting this issue when I try to use fromWorker in a project using Nx:

Types of property 'schedule' are incompatible.
    Type '<T>(work: (this: import("/Users/{ omitted }/node_modules/rxjs/src/internal/types").SchedulerAction<T>, state?: T) => void, delay?: number, state?: T) => import("/Users/{ omitted }/node_modules/rxjs/src/internal/Subscription").Subscription' is not assignable to type '<T>(work: (this: import("/Users/{ omitted }/node_modules/rxjs/internal/types").SchedulerAction<T>, state?: T) => void, delay?: number, state?: T) => import("/Users/{ omitted }/node_modules/rxjs/internal/Subscription").Subscription'.
      Types of parameters 'work' and 'work' are incompatible.
        The 'this' types of each signature are incompatible.
          Type 'import("/Users/{ omitted }/node_modules/rxjs/src/internal/types").SchedulerAction<T>' is not assignable to type 'import("/Users/{ omitted }/node_modules/rxjs/internal/types").SchedulerAction<T>'.
            Types of property 'schedule' are incompatible.
              Type '(state?: T, delay?: number) => import("/Users/{ omitted }/node_modules/rxjs/src/internal/Subscription").Subscription' is not assignable to type '(state?: T, delay?: number) => import("/Users/{ omitted }/node_modules/rxjs/internal/Subscription").Subscription'.
                Type 'import("/Users/{ omitted }/node_modules/rxjs/src/internal/Subscription").Subscription' is not assignable to type 'import("/Users/{ omitted }/node_modules/rxjs/internal/Subscription").Subscription'.
                  Property '_parentOrParents' is protected but type 'Subscription' is not a class derived from 'Subscription'.

After some googling and testing, it seems like the issue is the same as this issue in the rxjs repo. In run-worker.ts, you have:

import { NotificationKind } from 'rxjs/internal/Notification';

which is apparently what is throwing the error. I copied the code over to my project and replaced that import with this enum (which is what was being imported from the rxjs library):

export enum NotificationKind {
  NEXT = 'N',
  ERROR = 'E',
  COMPLETE = 'C'
}

After that, it works perfectly. I can open a pull request and make the change myself if you want. Or, it's just replacing that one import that fixed my particular issue if you want to make the change.

Keep up the good work!

@zakhenry
Copy link
Collaborator

Ah interesting issue, hah that is a coincidence as I was the one to add that enum to RxJS in the first place: https://github.com/ReactiveX/rxjs/pull/4405/files

Funny that would come back to bite me. I'll fix this shortly

@jafaircl
Copy link
Author

Thanks for the quick response! That's a pretty funny coincidence for sure. Just so you know, there's another similar reference in from-worker-pool.ts where you're importing ObservableInput from rxjs/src/internal/types

@zakhenry
Copy link
Collaborator

🎉 This issue has been resolved in version 3.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants