amis-rpc-design/node_modules/react-redux/es/connect/verifySubselectors.js

17 lines
688 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
import warning from '../utils/warning';
function verify(selector, methodName) {
if (!selector) {
throw new Error(`Unexpected value for ${methodName} in connect.`);
} else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) {
warning(`The selector for ${methodName} of connect did not specify a value for dependsOnOwnProps.`);
}
}
}
export default function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps) {
verify(mapStateToProps, 'mapStateToProps');
verify(mapDispatchToProps, 'mapDispatchToProps');
verify(mergeProps, 'mergeProps');
}