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

Compatibility of ngx-ui-scroll version 2.0.0 with Angular 7 #262

Closed
anasrbh opened this issue Apr 19, 2021 · 10 comments
Closed

Compatibility of ngx-ui-scroll version 2.0.0 with Angular 7 #262

anasrbh opened this issue Apr 19, 2021 · 10 comments

Comments

@anasrbh
Copy link

anasrbh commented Apr 19, 2021

Hello and thank you for the enormous work you have done.

I wanted to know if version 2.0.0 of the library can be compatible with Angular 7 ?

Thank you.

@anasrbh anasrbh changed the title Compatibility of ngx-ui-sxroll version 2.0.0 with Angular 7 Compatibility of ngx-ui-scroll version 2.0.0 with Angular 7 Apr 19, 2021
@dhilt
Copy link
Owner

dhilt commented Apr 19, 2021

@anasrbh Yes, it should work, I placed "ngx-ui-scroll v2 / Angular 7" demo on stackblitz, please take a look: https://stackblitz.com/edit/ngx-ui-scroll-2-with-angular-7

@anasrbh
Copy link
Author

anasrbh commented Apr 20, 2021

@dhilt Thank you for your response. I'm glad it works for angular 7. But in my case, I get error messages during compilation when I upgrade from version 1.11.1 of ngx-ui-scroll to 2.0.2. Maybe I missed something.

Here are the error messages:

Capture d’écran (18)

Here is how I instantiated the datasource :

Capture d’écran (21)

@dhilt
Copy link
Owner

dhilt commented Apr 20, 2021

@anasrbh Thanks for details! It seems to be a Typescript compatibility issue. The point is that vscroll is built with Typescript 4 and uses Omit helper type which was introduced in Typescript 3.5.1. The nearest Angular version supporting TS 3.5 is Angular 8.2. I would certainly not insist on updating the Angular, but it might be a good solution while I'm looking at the problem on the lib's end.

@anasrbh
Copy link
Author

anasrbh commented Apr 20, 2021

@dhilt Ok, I'll try to update Angular and see if the problem is fixed.
Do you think there is a chance that the latest version of ngx-ui-scroll might work on Angular 7 ?

@dhilt
Copy link
Owner

dhilt commented Apr 20, 2021

@anasrbh Omit is not the only problem, I'm afraid. I can get rid of TS Omit, but "ambient context" is much more painful thing, there was a breaking change introduced in TS 3.7 -- microsoft/TypeScript#33939 -- it made 3.7+ compiled code incompatible with the code compiling by the previous (3.7-) TS versions. And Angular 8 will not help, only Angular 9 will. I need to think... fixing this on the lib's end might be quite expensive. But let's not rush to conclusions.

Meanwhile there is a simplest workaround, you may turn the external libs checking off by adding the following to your tsconfig.json:

"skipLibCheck": true,

This will degrade type checking, but will allow to compile incompatible TS pieces.

@anasrbh
Copy link
Author

anasrbh commented Apr 20, 2021

@dhilt I added the "skipLibCheck" option to tsconfig. This certainly made the "TS Omit" and "ambient context" errors disappear.
But there is always a compilation error following the instantiation of the datasource.

Capture d’écran (25)

This may be due to the new type of the adatper variable in the datasource constructor :

Capture d’écran (26)

Maybe i need to update angular to at least version 8.2 to get rid of this error message.

I was also wondering is there a real change between version 1.11.1 and 2.0.2 ?

Thank you.

@dhilt
Copy link
Owner

dhilt commented Apr 20, 2021

@anasrbh The main purpose of v2 release is extracting the core into a separate framework-independent npm package vscroll, which is going to be used outside the Angular universe. It was accompanied with multiple infrastructure updates, and in particular vscroll uses TS4.

I just pushed a new tiny Angular7 project with ngx-ui-scroll v2 and skipLibCheck setting into Github, for me it works as expected, both "start" and "build" scripts: https://github.com/dhilt/angular-7-ngx-ui-scroll-2. Please try it? There might be an important difference in the lib usage between your home.component.ts and the demo's app.component.ts.

@anasrbh
Copy link
Author

anasrbh commented Apr 20, 2021

@dhilt Thank you for taking the time to create the project on Github. You are right, it works well. And when I returned back to my project, I uninstalled and reinstalled ngx-ui-scroll and I no longer see the error related to instantiating the datasource.

However, I see errors when I try to use the adapter functions (relax, reload, check ...) :

Capture d’écran (28)

I think this is normal as the adapter is of type IAngularAdapter which extends Omit <IAdapter , keyof IReactiveOverride>. As Omit is not recognized by typescript versions lower than 3.5.1. This must have generated the error :

Capture d’écran (26)

What do you think ?

@dhilt
Copy link
Owner

dhilt commented Apr 20, 2021

@anasrbh Well, I cleaned up the code from all incompatible TS expressions except "ambient context", which should be covered by skipLibCheck option. Please try ngx-ui-scroll v2.0.3 with skipLibCheck.

@anasrbh
Copy link
Author

anasrbh commented Apr 20, 2021

@dhilt Thank you so much ! I installed the new version and added skipLibCheck and it works fine.
I know it's just a temporary pseudo solution but it seems to be enough to make the virtual scroll work well in my case.

I close the ticket wishing you good luck for further improvements in this library.

Have a good day !

@anasrbh anasrbh closed this as completed Apr 20, 2021
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