JSFiddle - React, Tailwind, and code Playground

by gianlucaguarini

HTML

<script src="https://unpkg.com/prop-types/prop-types.js"></script>

JavaScript

const BAR_STRUCT = Object.seal({
  foo: 'foo'
})

const PROPS_STRUCT = Object.freeze({
  bar: PropTypes.instanceOf(BAR_STRUCT)
})

const props = {
  bar: Object.create(BAR_STRUCT)
}

console.log(BAR_STRUCT.isPrototypeOf(props.bar))
PropTypes.checkPropTypes(PROPS_STRUCT, props, 'prop', 'Dummy')