Skip to content

Commit 31bf205

Browse files
committed
Protect against missing prop type
1 parent ad8185a commit 31bf205

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const wrapPropTypes = () => {
2424
const original = _.cloneDeep(PropTypes)
2525

2626
_.each(_.keys(GENERATORS), (k) => {
27+
if (PropTypes[k] === undefined) return
2728
if (PropTypes[k].isRequired !== undefined) {
2829
// Simple type. Just extend the object
2930
PropTypes[k] = addHiddenProperties(PropTypes[k], 'type', k)

test/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ describe('generateProps (correct)', () => {
176176

177177
describe('given a required symbol', () => {
178178
it('generates a symbol', () => {
179+
if (PropTypes.symbol === undefined) return
180+
179181
const propTypes = { mySymbol: PropTypes.symbol.isRequired }
180182
ComponentAsClass.propTypes = propTypes
181183
ComponentAsFunction.propTypes = propTypes

0 commit comments

Comments
 (0)