Code Monkey home page Code Monkey logo

Comments (11)

SethDavenport avatar SethDavenport commented on September 4, 2024 2

Hi @nareshbhatia I took a look at your repo - it looks like you're using the redux typings from definitely typed. Redux 3.4 now ships with its own official typings in npm.

Let me suggest a few minor changes to your seed:

Change 1: In your typings.json you need to remove the entry for Redux. Then do

rm -rf typings; typings install

This will let typescript pull in the correct typings from your node_modules.

Change 2:

The official redux typings require an initial state in createStoreWithMiddleware. So in your main.ts, online 13, I suggest something like:

const store = createStoreWithMiddleware(rootReducer, {});

Change 3:

Finally, the redux-thunk typings are very out-of-date in definitely-typed, and don't play well with the official redux typings. Hopefully me or someone else will have time to make a PR against redux-thunk for correct typings.

For now in my project I use redux-thunk in untyped form: instead of import-ing it, I do:

const thunk = require('redux-thunk').default;

Hope, this helps,
Seth

from store.

nareshbhatia avatar nareshbhatia commented on September 4, 2024

Is this the appropriate place to ask this question? Happy to take it somewhere else if more appropriate.

from store.

wbuchwalter avatar wbuchwalter commented on September 4, 2024

Hey Narash,

I'm currently on a trip, so didn't had time to take a look at your issue!

Will try to do so soon.

Might be a good idea to duplicate your issue on angular-seed too.

Thanks

from store.

nareshbhatia avatar nareshbhatia commented on September 4, 2024

Good idea - I will create an issue on angular2-seed too.

from store.

nareshbhatia avatar nareshbhatia commented on September 4, 2024

I have an issue logged for this on angular2-seed. More importantly, I created a new project that combines angular2-seed + ng2-redux: https://github.com/archfirst/angular2-seed-redux. I had to install bunch of type definitions that I did not see in the README steps here. Anyway, I am currently stuck on a very basic error:

src/client/main.ts(7,25): error TS2307: Cannot find module 'ng2-redux'.

I can't figure this one out. I have installed the ng2-redux package and it exists in my node_modules folder. So I can't understand why the compiler doesn't find it.

I would really appreciate if someone on this group can help me get this combination working. Thanks in advance for all your help.

from store.

wbuchwalter avatar wbuchwalter commented on September 4, 2024

Hey Naresh,
Typings for ng2-redux is currently a work in progress.
Everything is being rewritten directly in TypeScript (here).
I think @e-schultz and @bennett000 are going to release a beta on npm very soon.

from store.

bennett000 avatar bennett000 commented on September 4, 2024

@nareshbhatia src/client/main.ts(7,25): error TS2307: Cannot find module 'ng2-redux' my guess is that this module is not being found (by tsc) because it lacks typings.

  • One solution to this would be to use a library like typings to install ng2-redux typings from a source like Definitely typed.
  • Another solution would be to use the beta version of ng2-redux which can be installed with a command like npm install --save-dev ng2-redux@beta.

Additionally you can take a look at this starter which uses ng2-redux and Angular 2 to assemble a minimal "starter" application.

from store.

SethDavenport avatar SethDavenport commented on September 4, 2024

@nareshbhatia: we just released version 2.2.3 which has been rewritten in typescript and thus includes typings. That should resolve your TS2307 error at least.

Can you give it a try?

from store.

nareshbhatia avatar nareshbhatia commented on September 4, 2024

Thanks @SethDavenport. The TS2307 is gone. However, I am getting the following errors now.

/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(13,24): error TS2315: Type 'Store' is not generic.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(20,34): error TS2315: Type 'Store' is not generic.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(30,54): error TS2315: Type 'Dispatch' is not generic.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(30,78): error TS2315: Type 'ActionCreator' is not generic.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(30,110): error TS2305: Module 'Redux' has no exported member 'ActionCreatorsMapObject'.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(44,90): error TS2305: Module 'Redux' has no exported member 'Unsubscribe'.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(56,48): error TS2305: Module 'Redux' has no exported member 'Unsubscribe'.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(66,52): error TS2305: Module 'Redux' has no exported member 'Action'.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/ng-redux.d.ts(70,32): error TS2305: Module 'Redux' has no exported member 'Action'.
/Users/nbhati/projects/angular2-seed-redux/node_modules/ng2-redux/lib/components/provider.d.ts(3,44): error TS2315: Type 'Store' is not generic.

You should be able to reproduce them on my project: https://github.com/archfirst/angular2-seed-redux

from store.

nareshbhatia avatar nareshbhatia commented on September 4, 2024

Thanks @SethDavenport. That fixes all the compile errors.

from store.

SethDavenport avatar SethDavenport commented on September 4, 2024

Happy to help.

from store.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.