facebook / prop-types

Runtime type checking for React props and similar objects
MIT License
4.48k stars 358 forks source link

error (checkPropTypes is not a function) while using with sveltekit #378

Open code-masala opened 2 years ago

code-masala commented 2 years ago
    import * as PropTypes from "prop-types";
    const {checkPropTypes, number} = PropTypes;
       const propTypes = {
        threshold: number,
    };
    checkPropTypes(propTypes, $$props, "prop", "Observer");

This is giving error checkPropTypes is not a function

ljharb commented 2 years ago

import * as is almost never what you want; this is a CJS package so I’d suggest instead import PropTypes from ‘prop-types’, and then PropTypes.checkPropTypes.