typicode / react-fake-props

🔮 Magically generate fake props for your React tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested shape objects

asantos00 opened this issue · comments

Hi guys,

Thank you so much for your work on this project. While using this I find that it breaks when there are components with nested shape objects, like the following.

Component.propTypes = {
	randomObject: PropTypes.shape({
		randomNested: PropTypes.shape({
			insideNestedString: PropTypes.string
        })
    })
}

This breaks with TypeError: Cannot read property 'optional' of undefined.

Thanks!

Just figured out it is a bug in the getShape function, I'll submit a PR with this :)