Created
February 5, 2018 06:55
-
-
Save eddyw/26289329fd9fd774bffe074370d37249 to your computer and use it in GitHub Desktop.
Type-checking Redux State with propTypes (without React)
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
import TodoReducer from 'TodoReducer' | |
import { createStore } from 'redux' | |
const store = createStore(TodoReducer) | |
store.dispatch({ | |
type: 'ADD_TODO', | |
payload: { | |
title: 'Example', | |
done: 1, | |
}, | |
}) | |
// Console Outputs: | |
// Warning: Failed property type: Invalid property `state[0].done` | |
// of type `number` supplied to `TodoReducer`, expected `boolean`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment