Skip to content

Instantly share code, notes, and snippets.

@bmihelac
Created November 19, 2015 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmihelac/ebba330d1a2bbd96c139 to your computer and use it in GitHub Desktop.
Save bmihelac/ebba330d1a2bbd96c139 to your computer and use it in GitHub Desktop.
ES6 import typo
export const UPDATE_REQUEST = 'UPDATE_REQUEST';
import * as types from '../constants/actionTypes';
export default function pouchdbReducer(state = {}}, action) {
switch (action.type) {
case types.UPDDATE_REQUEST:
// there is a typo above which evaluates to `undefined`
// this code would never be reached - how to make it an error
return Object.assign({}, state, {updated: true});
default:
return state;
}
}
@bmihelac
Copy link
Author

case types.UPDDATE_REQUEST.toString():

would raise TypeError if it is undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment