ngrx / store

RxJS powered state management for Angular applications, inspired by Redux
MIT License
3.9k stars 310 forks source link

export generated function as a Reducer (AOT) #458

Closed montella1507 closed 7 years ago

montella1507 commented 7 years ago

Hello everyone,

i would like to ask you if you know how to succesfully export generated reducer:

i have my own reducer generator with fluent API and final method build() which returns a reducer itself, so the usage is like: ` // reducer.ts

export const patientInfoReducer : (state, action) => CommonDataAppmodel = new TypedReducer<CommonDataAppmodel, PatientInfoActions>(initialState) .case(PatientInfoActionTypes.PATIENT_INFO_READY, (state, action) => { return action.payload.success ? { data: action.payload.data, error: false, loading: false} : { data: {}, error: true, loading: false}; }) .case(PatientInfoActionTypes.LOAD_PATIENT_INFO, () => ({ data: initialState.data, error: false, loadng: false})) .case(GlobalDataActionTypes.RESET_PATIENT_DATA, () => initialState) .build(); `

return type of build() method is reducer: (state, action) => CommonDataAppmodel<UserModel>

however if i want to use in in AOT build: ` // index.ts

export const reducers: ActionReducerMap = { patientInfo: patientInfoReducer };`

i cant and i will get error because "calling functions is not suported, use exported... ".