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

requirePropFactory updates #23

Merged
merged 2 commits into from
Jan 14, 2021

Conversation

mnajdova
Copy link
Owner

packages/material-ui-utils/src/requirePropFactory.d.ts Outdated Show resolved Hide resolved
Comment on lines 15 to 22
const defaultPropType = Component?.propTypes?.[propFullNameSafe];
let defaultPropTypeVal = null;

if(defaultPropType) {
console.log("Default prop type existed");
defaultPropTypeVal = defaultPropType(props, propName, componentName, location, propFullName)
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties in Component.propTypes (e.g. PropTypes.string) are referred to as "type checkers" or "validators". And then you could name their return value validatorResult or typeCheckerResult.

The current naming seems overly generic to me. Especially looking at the return statement "return defaultPropTypeVal".

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to defaultTypeChecker & defaultTypeCheckerResult. I use the default prefix, as we are not defining a new type checking for the property

@mnajdova mnajdova merged commit 7da608c into feat/grid-migrate-to-emotion Jan 14, 2021
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.

3 participants