Last active
January 21, 2017 01:21
-
-
Save aaronjensen/ece9682ff606ebfc7f0fce4d3508bd7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This won't type check even when correct | |
export default function reducer(state: SessionState = initialState, action: SetCurrentUserAction): SessionState { | |
let newState | |
switch (action.type) { | |
case 'SET_CURRENT_USER': | |
newState = { loaded: true, currentUser: action.payload } | |
} | |
return newState | |
} | |
// This type checks even when incorrect | |
export default function reducer(state: SessionState = initialState, action: SetCurrentUserAction): SessionState { | |
switch (action.type) { | |
// case 'SET_CURRENT_USER': | |
case 'BAD': | |
state = { loaded: true, currentUser: action.payload } | |
} | |
return state | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment