mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add PropType validation for next/head children (#5504)
Give `Head` a more detailed error messages in dev mode by validating the children prop's PropTypes.
This commit is contained in:
parent
2c343baeba
commit
98568046a3
|
@ -100,4 +100,12 @@ function unique () {
|
|||
}
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const exact = require('prop-types-exact')
|
||||
|
||||
Head.propTypes = exact({
|
||||
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]).isRequired
|
||||
})
|
||||
}
|
||||
|
||||
export default sideEffect(reduceComponents, onStateChange, mapOnServer)(Head)
|
||||
|
|
Loading…
Reference in a new issue