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

Unused patched operator in ./src/rxjs.imports.ts: switchMap #23

Closed
kamok opened this issue Dec 19, 2017 · 4 comments
Closed

Unused patched operator in ./src/rxjs.imports.ts: switchMap #23

kamok opened this issue Dec 19, 2017 · 4 comments

Comments

@kamok
Copy link

kamok commented Dec 19, 2017

I'm getting this error with the switchMap operator.

I have plenty of other operators in rxjs.imports.ts so it's not any other issues except for switchMap.

I DO use switchMap in the application.

Perhaps this is the same problem with the flatMap issue? I'm not sure. I'm going to refactor the code to not use switchMap as the person who used it said they didn't use it for switchMap's intended purpose.

@cartant
Copy link
Owner

cartant commented Dec 19, 2017

Be ware that this gotcha can effect false positives for unused patches. Similarly, if the observable instance to which the patched operator is applied is not typed as an Observable the static analysis will not consider it to be a use of the operator.

switchMap is not an alias, so this is unrelated to any flatMap issue.

@kamok
Copy link
Author

kamok commented Dec 20, 2017

Thank you for clarifying this:

Similarly, if the observable instance to which the patched operator is applied is not typed as an Observable the static analysis will not consider it to be a use of the operator.

This was NOT appended to Observable, but an Angular library object.

I am closing this.

@kamok kamok closed this as completed Dec 20, 2017
@cartant
Copy link
Owner

cartant commented Dec 20, 2017

This was NOT appended to Observable, but an Angular library object.

I should have said that the type needs to be Observable or an Observable-derived type. The real problem is when patched operators are used with values that have any as their type. The static analysis won't consider them to be observables.

What was the Angular object that effected the unused error? If it's not any, what is it?

@kamok
Copy link
Author

kamok commented Dec 21, 2017

@cartant It was a paramMap from a ActivatedRoute

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

2 participants