我正在使用ngrx,但出现以下错误[Angular 6]
ERROR in src/app/app.component.ts(3,10): error TS2305: Module '"C:/Angular Activity/NgRxExample/currency-conversion/src/app/actions/amount"'
has no exported member 'AmountChangeAction'.
src/app/app.module.ts(6,9): error TS2305: Module '"C:/Angular Activity/NgRxExample/currency-conversion/src/app/actions/amount"' has no exported member 'AmountChangeAction'.
src/app/reducers/amount.ts(4,58): error TS2694: Namespace '"C:/Angular Activity/NgRxExample/currency-conversion/src/app/actions/amount"' has
no exported member 'AmountChangeAction'.
src/app/reducers/amount.ts(7,21): error TS2339: Property 'AMOUNTCHANGE' does not exist on type 'typeof import("C:/Angular Activity/NgRxExample/currency-conversion/src/app/actions/amount")'
currency.ts
import {Currency} from './../models/currency';
import { Action } from '@ngrx/store';
export const CURRENCIESUPDATE = '[Currency] UpdateAll';
export const CURRENCIESUPDATED = '[Currency] UpdatedAll';
export class CurrenciesUpdateAction implements Action {
readonly type = CURRENCIESUPDATE
}
export class CurrenciesUpdatedAction implements Action {
readonly type = CURRENCIESUPDATED
constructor(public payload: Currency[]) {}
}
amount.ts:
import {Currency} from './../models/currency';
import { Action } from '@ngrx/store';
export const CURRENCIESUPDATE = '[Currency] UpdateAll';
export const CURRENCIESUPDATED = '[Currency] UpdatedAll';
export class CurrenciesUpdateAction implements Action {
readonly type = CURRENCIESUPDATE
}
export class CurrenciesUpdatedAction implements Action {
readonly type = CURRENCIESUPDATED
constructor(public payload: Currency[]) {}
}
请让我知道这有什么遗漏,我是第一次使用ngrx,所以如果它很傻,请原谅。
我正在使用角度6。
我的package.json:
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^7.4.0",
"@ngrx/store": "^7.4.0",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
答案 0 :(得分:0)
从共享的代码段来看,确实好像没有AmountChangeAction
操作。