Open michaelboyles opened 2 years ago
As a consequence of the code which handles code paths (if conditions etc.), Redcr always ends up reassigning the parameter, regardless of whether it actually needs to. For example
interface StringState { str: String } const reducer = redcr((state: StringState) => { state.str = 'foo'; });
The generated code looks like this
const reducer = (state) => { state = { ...state, str: 'foo' }; return state; };
It would be better if it returned this
const reducer = (state) => { return { ...state, str: 'foo' }; };
As a consequence of the code which handles code paths (if conditions etc.), Redcr always ends up reassigning the parameter, regardless of whether it actually needs to. For example
The generated code looks like this
It would be better if it returned this