angular-redux / store

Angular 2+ bindings for Redux
MIT License
1.34k stars 203 forks source link

Cannot run the example #165

Closed zalmoxisus closed 8 years ago

zalmoxisus commented 8 years ago

Trying to figure out an issue, wanted to run the counter example. First it requires immutable library. Then after installing it, there's an error in ./containers/App.ts (38,33): Supplied parameters do not match any signature of call target.

I'm not too familiar with typescript, and apologize if I'm missing something here.

SethDavenport commented 8 years ago

Hi @zalmoxisus, thanks for the bug report.

There are a couple of things going on here:

However when we're included via webpack, it's not understanding the conditional require on our end and outputs a warning. We'll look to suppress this going forwards.

Also I just noticed that the original issue you quoted is for angular 1 - this is the angular 2 connector :)

If you're still having issues with the angular 1 connector, I'll get in touch with my colleagues who work on https://github.com/angular-redux/ng-redux and we'll try to help you out.

SethDavenport commented 8 years ago

PS huge fan of the chrome extension - it's saved me a lot of headaches!

SethDavenport commented 8 years ago

Keeping the issue open pending resolution of the webpack warning. However you should be able to run the example app with npm run dev now.

SethDavenport commented 8 years ago

@clbond @e-schultz Turns out webpack's not a huge fan of the conditional require in utils/get-in.ts. It doesn't break anything, but we do get a scary-looking warning in the console and a large stack trace in the browser console.

We should see if there's a way to work around this. If we have to depend in immutable directly, we'll need to check two things:

An easy way to check the systemJS thing is load up the examples from the redux section of ngcourse2, update the ng2-redux dep, and see what happens...

zalmoxisus commented 8 years ago

@SethDavenport, thanks for the details and the feedback! It's a good example not only for using redux with angular, but also for integrating it with typescript.

Regarding conditional dependencies, I think easier is to just use it explicitly, so if I want to use the library with immutableJS, I would require ng2-redux/immutable instead of ng2-redux. Less magic, but it will also avoid including unnecessary libraries in the final bundle, just because I forgot to remove it form node_modules.

clbond commented 8 years ago

Hmm. I will take a look at this today. Thank you

SethDavenport commented 8 years ago

Thanks Chris.

I wonder if there's a way to do things that doesn't know about Immutable explicitly. E.g. look for a function called getIn on the selected object and call it if it exists.

Or for regular props try something foo.bar || foo.get('bar')