ng2-ui / auto-complete

Angular Auto Complete component and directive
http://ng2-ui.github.io/auto-complete/
MIT License
279 stars 124 forks source link

add RxJS 6 support #344

Closed kv-michal closed 6 years ago

kv-michal commented 6 years ago

IMPORTANT Current version of auto-complete doesn't support RxJS 6.

Steps to reproduce and a minimal demo Import auto-complete to project which uses RxJS 6 (without rxjs-compact).

Current behavior Angular CLI 6 returns error:

ERROR in node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
node_modules/@ngui/auto-complete/dist/auto-complete.d.ts(2,10): error TS2305: Module '"C:/<path-to-project>/node_modules/rxjs/Observable"' has no exported member 'Observable'.
almothafar commented 6 years ago

I'm not sure if this is really happening because of this module, but it seems something missing from your side, I need to try this and confirm it from my side, as I see something wrong from RxJS module, what the version of auto-complete you use?

dariusungur commented 6 years ago

I think the issue is related to the rxjs. I managed to fix it by typing the following command: npm install rxjs@6 rxjs-compat@6 --save

kv-michal commented 6 years ago

@almothafar @dariusungur I wanted to use auto-complete library without importing rxjs-compact (which adds backwards compatibility). That's why I created this issue. I use many 3rd party libraries, but I need to import extra rxjs-compact, because current auto-complete doesn't support RxJS 6.

I think you need to change imports and use pipeable operators. I.e.

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';

To RxJS 6 style:

import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

observable.pipe( map() )
almothafar commented 6 years ago

@kv-michal I understand this, but most of the projects still ongoing with Angular 5, pushing it to Angular 6 will break the version 5, actually importing rxjs-compact is a part of the migration and the middle solution for not breaking things.

Maybe later when Angular 6 become commonly used more than version 5 I'll apply RB #351

ArnaudPel commented 6 years ago

Could anyone please confirm they've been able to make auto-complete work with rxjs-compat ? As far as our experiments went, it doesn't.

If it does work and we missed something, could someone be so kind as to push a PR to update the readme ? Many thanks.

If it doesn't, on a more wishful approach, @almothafar would it be conceivable to maintain two versions of auto-complete, one for Angular 5, and the other for Angular 6 ? I understand this implies more work, like cherry-picks, and I'm not familiar enough with the npm ecosystem to know whether it is a usual practice, but maybe..

almothafar commented 6 years ago

There is PR #351 I may merge it soon.

ArnaudPel commented 6 years ago

Thank you for your quick reply. Yes I mentioned the maintenance of two branches precisely because you indicated the drawbacks of merging #351. For example, version 1.X could keep evolving with Angular 5 compatibility and still get bugfixes, while a new version 2.X could be created to include #351 and subsequent new features. The drawback is that you have to cherry-pick bugfixes (and possibly some new features) from the 2.X branch to 1.X.

Anyway, would you have an ETA in mind for the merge ? Thanks again.

webcat12345 commented 6 years ago

@almothafar , Now Rxjs 6 and Angular 6 is quite common and most of packages are supporting Rxjs6 as well. Can we merge this and add some important tip to versioning?

almothafar commented 6 years ago

I did that already, once I get to home, I will build it and publish the new version

surfdew commented 6 years ago

Can we get the new version with rxjs 6 please? I've been waiting for a few days to do the full upgrade. This is blocking. Thanks!

almothafar commented 6 years ago

I'm really sorry about this, I got some dev environment issues in home PC and so busy at work to get this done, I'll try to do that soon.

almothafar commented 6 years ago

Version 2.0.0 should support version 6 angular and rxjs, sorry for delay again

surfdew commented 6 years ago

Thanks!

Dmallesh commented 5 years ago

Hi there,

is there new version of ng2-auto-complete with rxjs 6? I'm still receiving "Module not found: Error: Can't resolve 'rxjs/add/operator/map'".

Please help!