ngrx / platform

Reactive State for Angular
https://ngrx.io
Other
8.06k stars 1.98k forks source link

Angular 5 support #538

Closed MattiJarvinen closed 7 years ago

MattiJarvinen commented 7 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request

What is the current behavior?

Package.json lists Angular ^4.0.0, should append || ^5.0.0 now that it's out.

Run tests & upgrade dependencies.

Expected behavior:

Installable with angular 5

warning "@ngrx/effects@4.1.0" has incorrect peer dependency "@angular/core@^4.0.0".
warning "@ngrx/store@4.1.0" has incorrect peer dependency "@angular/core@^4.0.0".

Minimal reproduction of the problem with instructions:

Existing platform project yarn upgrade -S @angular --latest

"@ngrx/store@4.1.0" has incorrect peer dependency

Version of affected browser(s),operating system(s), npm, node and ngrx:

Angular 5.0.0
@ngrx/store 4.10
@ngrx/effects 4.10

Maybe more ngrx/platform packages

Other information:

List of Angular 5 breaking changes from the looks of it previously deprecated code was removed.

Possible gotchas

platformXXXX() no longer accepts providers which depend on reflection. Specifically the method signature when from Provider[] to StaticProvider[].

Future deprecations

ReflectiveInjector is now deprecated as it will be remove. Use Injector.create as a replacement.

radoslavpetranov commented 7 years ago

Because the Issues section of the 2.x store is disabled I thought I'd ask here.

Could you let us know if there are any plans to make 2.x Angular 5 compatible or will we be forced to switch to latest if we want to migrate to Angular 5?

ERROR in node_modules/@ngrx/effects/src/bootstrap-listener.d.ts(1,20): error TS2305: Module '"F:/whatever/node_modules/@angular/core/core"' has no exportedmember 'OpaqueToken'.
node_modules/@ngrx/effects/src/effects-subscription.d.ts(1,10): error TS2305: Module '"F:/whatever/node_modules/@angular/core/core"' has no exported member'OpaqueToken'.
node_modules/@ngrx/effects/src/effects.module.d.ts(1,16): error TS2305: Module '"F:/whatever/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.
node_modules/@ngrx/router-store/src/router-store-module.d.ts(1,10): error TS2305: Module '"F:/whatever/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.
node_modules/@ngrx/store-devtools/src/config.d.ts(2,10): error TS2305: Module '"F:/whatever/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.
node_modules/@ngrx/store-devtools/src/extension.d.ts(1,10): error TS2305: Module '"F:/whatever/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.
node_modules/@ngrx/store/src/ng2.d.ts(1,10): error TS2305: Module '"F:/whatever/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.
born2net commented 7 years ago

same issues here:

Error:(1, 20) TS2305:Module '"C:/msweb/studio-lite/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.
born2net commented 7 years ago

I have the same question as @radoslavpetranov we are using ngrx 1.2.0 and was wondering if you can please make it upgradable to ng 5 as well?

nhducseuit commented 7 years ago

Would love to see this supported asap :)

phra commented 7 years ago

yep, OpaqueToken was removed in angular 5 :cry:

radoslavpetranov commented 7 years ago

I just realized material2 is now in RC.0 and this new version (which includes a bunch of important fixes) requires Angular 5. So basically if I want to upgrade material I have to upgrade to Angular 5 which I can't do without upgrading the entire state management of my app as it stands right now.

I understand this is a free library and I very much appreciate everyone's work but could you guys just share your plans with us so we know whether we can focus on our regular work knowing that ngrx 2.x will be compatible with Angular 5 at some point in the coming days or whether we should halt what we're doing and focus on redoing our state management.

Your input would be very much appreciated!

MikeRyanDev commented 7 years ago

I have investigated this and here's the problem: we can't upgrade 2.x/3.x to support Angular 5 without it being a breaking change for apps still using NgRx 2.x/3.x with Angular 2.x because InjectionToken is not present in Angular 2.x.

Therefore we will not be patching NgRx 2.x/3.x to add Angular 5 support. To move to Angular 5 you will also need to upgrade to NgRx 4.

To clarify another issue: NgRx 4 does support Angular 5. We just haven't published a release with updated semver ranges in package.json.

MikeRyanDev commented 7 years ago

I would like to know what issues remain in NgRx 4 that are making the migration difficult. If the issues are significant enough, I am open to investigating making a compatibility package for NgRx 2 -> NgRx 4.

pmulac commented 7 years ago

@MikeRyanDev Do you plan to publish an Angular-5-compatible release of ngrx 4 soon? It’s important for those of us that need to shrink wrap.

MikeRyanDev commented 7 years ago

@pmulac Oh, right, shrinkwrap. I'll publish one now. Was waiting for some other fixes.

MikeRyanDev commented 7 years ago

Ok, published. Closing this issue. If there are significant blocking issues preventing you from upgrading to NgRx 4 please open a new issue.

phra commented 7 years ago

@MikeRyanDev i will try and report if i find issues with the updated package!

radoslavpetranov commented 7 years ago

Thanks for the headsup @MikeRyanDev !

phra commented 7 years ago

i can confirm that with this package.json it works:

╭─phra at kali in XXXXXXXXXXXXX (master ●2✚2)
╰─λ grep ngrx package.json                                                                                                                                       0 < 00:11:44
    "@ngrx/effects": "^4.1.1",
    "@ngrx/router-store": "^4.1.1",
    "@ngrx/store": "^4.1.1",
    "@ngrx/store-devtools": "^4.1.1",
    "ngrx-store-localstorage": "^0.2.4",
    "ngrx-store-logger": "^0.2.0",
ghost commented 7 years ago

I still have this problem, when running the platform/example-app with Angular 5: ERROR in node_modules/@ngrx/db/src/database.d.ts(3,10): error TS2305:
Module '"... /node_modules/@ angular/core/core"' has no exported member 'OpaqueToken'. with @ngrx/db@2.0.2 Has anybody any workarounds? Thanks in advance!

jraadt commented 7 years ago

Looks like there is a pull request (https://github.com/ngrx/db/pull/22) that needs to be merged. Hopefully @MikeRyanDev will be able to merge it soon.