Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Compiler brakes ngrx effects #29

Open
vforv opened this issue Nov 18, 2017 · 4 comments
Open

Compiler brakes ngrx effects #29

vforv opened this issue Nov 18, 2017 · 4 comments

Comments

@vforv
Copy link

vforv commented Nov 18, 2017

Hello @alexeagle

After I add ngrx store it dosn't work on client side, could you check my repo:

https://github.com/vforv/closure-compiler

To start just type:

npm i
npm start

it will build server side with webpack and client with closure...

I get this error:

Uncaught TypeError: this.T is not a function
at vb (client.js:28)
at client.js:511
at Array.map ()
at Cr (client.js:511)
at b.Dr [as ga] (client.js:512)
at b.xl (client.js:58)
at b.g (client.js:57)
at b.next (client.js:7)
at b.next (client.js:12)
at b.Fj (client.js:43)

It looks like it brakes EffectsModule... When I remove EffectsModule it works...

@vforv vforv changed the title Compiler brakes ngrx store Compiler brakes ngrx effects Nov 18, 2017
@alexeagle
Copy link
Contributor

Maybe @MikeRyanDev would be interested to add some closure compiler compatibility check? We use it at Google so maybe aokrushko can confirm that this works with closure compiler internally.

@MikeRyanDev
Copy link
Member

@alexeagle Definitely interested. I know we break it for Closure users semi-regularly but I don't know enough about Closure to add a useful compatibility test suite.

cc @robwormald

@alexeagle
Copy link
Contributor

alexeagle commented Jan 4, 2018 via email

@alex-okrushko
Copy link

Hey all,

So the closure strips properties from effects, because "they are not used".

To force them to be there you can declare the interface. That's the best workaround for the moment. I'm also working to find the combination of closure flags that leaves @Effects properties there, yet does property renaming and collapsing.

so the workaround:

export declare interface LoadUserEffectsProps {
   userAcc$: Observable<Action>;
}

@Injectable()
export class LoadUserEffects implements LoadUserEffectsProps {
    constructor(private actions$: Actions, private userService: UserService) {
    }

    @Effect() userAcc$: Observable<Action> = this.actions$
        .ofType(USER_ACTION)
     ...

I was looking into it in December but I was on "vacation" since mid-December and am still on vacation until next week. (vacation with 3 toddlers :) so rarely have time to get to laptop).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants