Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoist proptypes #51

Merged
merged 2 commits into from Feb 17, 2017
Merged

Hoist proptypes #51

merged 2 commits into from Feb 17, 2017

Conversation

colbyr
Copy link
Contributor

@colbyr colbyr commented Feb 17, 2017

The "Connected" Component generated by connect inherits propTypes unrelated to the store dependencies from the BaseComponent.

So if a Component passed to connect declares a count propType and there is not count field in the dependency...

class CountComponent extends Component {
  static propTypes = {
    count: PropTypes.number,
    user: PropTypes.object,
  };

  // ...
}

export default connect({user: UserStore})(CountComponent);

That Component returned by connect will have a propType signature like...

const propTypes = {
  count: PropType.number,
};

Previously the connected component would only receive the types defined in it's dependencies without any additionally types from the BaseComponent. This can be problematic if propTypes are used as a programatic interface in parent components. Perhaps not common, but relevant for some.

TODOs

  • linter, checker, and test are passing
  • any new public modules are exported from src/GeneralStore.js
  • version numbers are up to date in package.json and bower.json
  • CHANGELOG.md is up to date

@colbyr
Copy link
Contributor Author

colbyr commented Feb 17, 2017

Also adds a yarn.lock file

@colbyr colbyr merged commit e16326d into master Feb 17, 2017
@colbyr colbyr deleted the hoist-proptypes branch February 17, 2017 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant