-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Property 'distinct' does not exist on type Observable<CustomType> #1560
Comments
Import Closing issue, please feel freely reopen if it's not resolved. |
Also one thing forgot, you may able to import // patch Observable with appropriate methods
require('rxjs/add/operator/map');
Observable.of(1,2,3).map(function (x) { return x + '!!!'; }); // etc (cjs example, but typescript works same way) |
I tried that and it didnt work, but your first comment seems to work, thanks! |
how do I import the Rx.KitchenSink into my app? In the bundles folder is no js file for it, so system.js trys to get it from the server |
Ok, doesnt work at all, reopening now |
@SuperManitu , please check this plnkr at https://plnkr.co/edit/AF8TyxiIRbokxVBK27Iu . I've amended your pnlkr above. changes are
|
The KitchenSink build seems not to be part of the npm package, the only way to get it is the cdn |
I've been trying to import these additional operators into an angular2 + webpack project with no joy, and I've tried all of the typical solutions. If I recall, I had |
@zachgrayio would you mind to share some snippets to reproduce issue? |
@SuperManitu , I could confirm npm package also includes |
@kwonoj I'll try to get a repo or plunkr up sometime soon, thanks for the attn |
@kwonoj A bit of relevant info before I get around to uploading something: I'm working with a recent fork of https://github.com/angular/angular2-seed as a starting point, and I've opened an issue over there too as it might be more relevant to webpack than to rxjs: angular/angular2-seed#59 |
Yes, repo would be helpful. I'm having hand-crafted ng2-rxjs webpack configuration and so far it's working, I think it can be resolved somehow. |
Here's an example - i just forked the angular2-seed repo and followed the most common, basic instructions to import additional operators, with no other changes. Maybe this is a bit too naive, but I thought it was a good starting point: zachgrayio/angular2-seed-add-operators@aa40285 |
Here's a branch of the fork'd repo where I tried to resolve using Rx.KitchenSink, still no joy. zachgrayio/angular2-seed-add-operators@fd82bef |
@zachgrayio - try this : package.json "dependencies": {
"angular2": "2.0.0-beta.15",
"core-js": "^2.2.0",
- "rxjs": "5.0.0-beta.2",
+ "rxjs": "^5.0.0-beta.6",
"zone.js": "~0.6.11"
}, seed-app.ts import {Observable} from "rxjs/Observable";
-import 'rxjs/add/operator/distinct'
+import 'rxjs/add/observable/of';
+import 'rxjs/add/operator/distinct';
// relative paths to node_modules don't work any better:
What's changed?
|
@kwonoj Ah, ok that makes sense - I had a hunch this might be the case but never followed through. What version of ng2 are you running?
|
Oops, forgot peerdependency - I'm using npm@3 and installed rxjs separately, so it bypasses peerdependency check. At least there's angular/angular#8047 will bump up peerdependency as well. |
@kwonoj Awesome, I'll likely do the same thing. Good lookin' out dude! |
For anyone who ends up here, this is the commit that fixed my operator woes: zachgrayio/angular2-seed-add-operators@cdd825c If you run into the peer dependency issue due to being ahead of the peerdependency curve, you can install npm3 with |
I believe latest b.6 correctly exports operator under |
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. |
My initial problem was here: http://stackoverflow.com/questions/36245443/add-data-to-observable
Now I figured out a solution by myself, using merge and map/filter. For this to work, I need the distinct Operator to kill double values, but my typescript complains that distinct is not part of the Observable, only distinctUntilChanged
RxJS version:
beta.2 and beta.4
Code to reproduce:
https://plnkr.co/edit/VAM0chq0VzQ90nA9AmcW
see in the console that distinct is not a function
Expected behavior:
I can use distinct as Operator
Actual behavior:
I cannot use it
Additional information:
using atom-ts for compiling typescript
The text was updated successfully, but these errors were encountered: