Platform: #153 introduced compile problems with AOT

Created on 26 Jul 2017  Â·  10Comments  Â·  Source: ngrx/platform

I'm submitting a...


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

What is the current behavior?

When compiling some projects with #153 and AOT, we get the following error:

ERROR in /home/vnoel/Linagora/Petals/dev/git/petals-cockpit/frontend/src/$$_gendir/node_modules/@ngrx/store/store.ngfactory.ts (51,65): Argument of type '{}' is not assignable to parameter of type 'StoreFeature<any, any>[]'.
Property 'includes' is missing in type '{}'.

Expected behavior:

It should compile fine :)

Minimal reproduction of the problem with instructions:

I couldn't reproduce it on a small repro, but my application is publicly available.
Clone https://gitlab.com/linagora/petals-cockpit.git, checkout 201e583230d81cd32821a32c67ffdccd1521d524, run yarn once, yarn run build

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

node 8, ngrx nightly (7f77693, the one with #153), angular 4.1.3 and angular-cli 1.3.0-rc.0.

Most helpful comment

Just in case it helps others, I got it working with:

All 10 comments

I too am having the same error with AOT compiling.

Versions affected:

  • Node v6.11.1
  • ngrx v4.0.2
  • Angular v4.1.3
  • Angular CLI v1.2.7

I swapped to Node v8.2.1 and upgraded Typescript both locally and globally to v2.4.2 and the error has gone away.

upgrading node didn't work for me, but downgrading @ngrx/store to v4.0.0 did.

I'm running into this as well however can't downgrade to v4.0.0 because of #189. @brandonroberts any guidance on this?

@victornoel got it working by upgrading Angular to 4.3.x

Hi there. Just to mention we too are experiencing this error when trying to switch to AOT:

ERROR in d:/ProjectRoot/src/node_modules/@ngrx/store/store.ngfactory.ts (51,65): Argument of type '{}' is not assignable to parameter of type 'StoreFeature[]'.
Property 'length' is missing in type '{}'.

ERROR in Error encountered resolving symbol values statically. Calling function 'TabsModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in d:/ProjectRoot/src/app/module.ts, resolving symbol AppModule in d:/ProjectRoot/src/app/module.ts

(maybe the second one is a separate thing, related to ngx-bootstrap, but those were the only errors, so posting it just in case).

I have no simple repro project to show, this is from the project we're working at. Environment:

  • ngrx 4.0.2
  • angular 4.1.1
  • rxjs 5.4.2
  • typescript 2.4.2
  • webpack 2.5.1
  • ngtools/webpack 1.4.2
  • angular/compiler-cli: 4.1.1 (we did not remove this yet)
  • node 6.6.2
  • npm 3.9.5
  • Win 10 64b

Just to specify that in the past we were not able to make AOT work with ngrx 2.x: there was an issue here here never "fixed" and now closed after the v 4.x came out.

Nope I don't think I did make it work...
For the record, I suspect the problem is caused by the fact ngrx is
compiled with ts 2.4 and the problems appear with lesser version of ts.

Le 11 août 2017 5:49 PM, "Matt Oliver" notifications@github.com a écrit :

@victornoel https://github.com/victornoel got it working by upgrading
Angular to 2.4.x

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ngrx/platform/issues/191#issuecomment-321849391, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAJ0z3GoSzwjJYavTQ1hZFv1N8KfTZp7ks5sXHgEgaJpZM4OjrRg
.

Just in case it helps others, I got it working with:

I got a simple repro project about this, BrainCrumbz/ngtools-webpack-demo/, where there's an empty state and a no-op reducer. All it really does related to ngrx is invoking StoreModule.forRoot(...).

As tracked in this issue, build error went away after upgrading angular (and zone.js).

I'm gonna close this issue as resolved with the latest packages mentioned above. If it can be reproduced with those packages a new issue can be opened.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oxiumio picture oxiumio  Â·  3Comments

gperdomor picture gperdomor  Â·  3Comments

itprodavets picture itprodavets  Â·  3Comments

hccampos picture hccampos  Â·  3Comments

dollyshah-02-zz picture dollyshah-02-zz  Â·  3Comments