Skip to content
This repository has been archived by the owner on Jan 10, 2018. It is now read-only.

Property does not exist on type typeof app.module. #247

Closed
wethinkagile opened this issue Oct 10, 2016 · 8 comments
Closed

Property does not exist on type typeof app.module. #247

wethinkagile opened this issue Oct 10, 2016 · 8 comments

Comments

@wethinkagile
Copy link

wethinkagile commented Oct 10, 2016

import { StoreModule } from "@ngrx/store";
import { currentPurchase } from "../shared/index";

@NgModule({
 imports: [
        IonicModule.forRoot(MyApp, {}),
        HttpModule,
        StoreModule.provideStore({currentPurchase})
    ]
..

I am getting Property currentPurchase' does not exist on type typeof app.module. The imported reducer looks like this:

import { ActionReducer, Action } from "@ngrx/store";
import { ActionType } from "./action-type";
import { PurchaseModel } from "../purchase/purchase.model";

export const currentPurchase: ActionReducer<PurchaseModel> = (state:PurchaseModel = new PurchaseModel(), action:Action) => {

    switch (action.type) {

        case ActionType.SET_PURCHASE:
            return (action.payload !== null) ? action.payload : new PurchaseModel();
        case ActionType.UPDATE_PURCHASE:
            return Object.assign({}, state, action.payload);
        default:
            return state;
    }
};

Also:

bildschirmfoto 2016-10-10 um 16 56 31

Any help is appreciated.

@wizardnet972
Copy link

Property currentPurchase' does not exist on type typeof app.module

the reducer and module seems ok.
maybe the init of PurchaseModel is got an error? or you can give the full error from the console?

Object.assign should come from core-js. see if you have latest core-js package installed.

was helpful?

@jeroennoten
Copy link

@nottinhill How did you solve this? I have the same problem.

@MarkPieszak
Copy link

What version of TS are you using? You just want to include es6 libs in your tsconfig, I believe that'll take care of it! @jeroennoten

@jeroennoten
Copy link

jeroennoten commented Dec 13, 2016

I found that replacing (following the example above) {currentPurchase} with {currentPurchase: currentPurchase} in combination with using a function declaration (export function currentPurchase(...) instead of a function expression assigned to a constant (export const currentPurchase...) does the job.

I don't see why my first solution with object shorthand and function expression does not work, though.

@jeroennoten
Copy link

BTW, I have es2015 included in my tsconfig.

@MarkPieszak
Copy link

I typically have the below, does that help any? Close and reopen that file. What version of TS?

 "lib": [ "es6", "dom" ],

@jeroennoten
Copy link

Upgrading to the latest version of typescript solved it, thanks!

@wethinkagile
Copy link
Author

wethinkagile commented Dec 14, 2016

My apologies fellow engineers, we moved so fast in the project, I forgot the solution. We already released. I this case I think we wrote root reducer and combined in seperate file and used that export in app.module. (being an AoT Ionic project)

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

5 participants