forked from reduxjs/react-redux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Duck-type subscription in prop checks (reduxjs#628)
* Duck-type subscription in prop checks Use `PropTypes.shape` instead of instanceOf checks which don't work across multiple instances of react-redux. Granted it's not a problem that _should_ occur since they should be deduped, but dependency management is hard, and sometimes that's not feasible due to symlinks and the like. This is (I think) is more idiomatic JS any way :) thanks! (sorry if something obvious is off i wrote this in the GH editor) * Centralize PropType shapes.
- Loading branch information
Showing
4 changed files
with
24 additions
and
19 deletions.
There are no files selected for viewing
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { PropTypes } from 'react' | ||
|
||
export const subscriptionShape = PropTypes.shape({ | ||
trySubscribe: PropTypes.func.isRequired, | ||
tryUnsubscribe: PropTypes.func.isRequired, | ||
notifyNestedSubs: PropTypes.func.isRequired, | ||
isSubscribed: PropTypes.func.isRequired, | ||
}) | ||
|
||
export const storeShape = PropTypes.shape({ | ||
subscribe: PropTypes.func.isRequired, | ||
dispatch: PropTypes.func.isRequired, | ||
getState: PropTypes.func.isRequired | ||
}) |
This file was deleted.
Oops, something went wrong.