facebook / prop-types

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

Proptypes warning after Upgrade Babel 7 #216

Closed palaniichukdmytro closed 5 years ago

palaniichukdmytro commented 6 years ago

Bug Report

Current Behavior After migration to Babel 7, arised such kind of warning. Looks like it belongs to react-redux connect. Is not correct proptypes for propValue.hasOwnProperty

Input Code

Warning: Failed prop type: propValue.hasOwnProperty is not a function
    in Application (created by Connect(Application))

Expected behavior/code Do not produce this warning for checkPropTypes.

Babel Configuration (.babelrc, package.json, cli command)

const nodeEnv = process.env.NODE_ENV || 'development'
let presetEnvConfig, plugins

if (nodeEnv === 'test') {
    presetEnvConfig = {targets: {node: 'current'}}
    plugins = ['istanbul']
} else {
    presetEnvConfig = {
        targets: {
            browsers: ['last 1 versions', 'ie >= 11']
        },
        modules: false,
    }
    plugins = ['react-hot-loader/babel']
}

const config = {
    presets: [
        ['@babel/preset-env', presetEnvConfig],
        '@babel/preset-react',
    ],
    plugins: [
        ...plugins,
        "@babel/plugin-syntax-dynamic-import", '@babel/plugin-proposal-class-properties',
        ["@babel/plugin-proposal-decorators", { "legacy": true }],
        "@babel/plugin-proposal-nullish-coalescing-operator",
        "@babel/plugin-proposal-optional-chaining",
        "@babel/plugin-proposal-numeric-separator"
    ],
}

module.exports = config

Environment

Possible Solution

Additional context/Screenshots

"react-redux": "^5.0.7",
"react-dom": "16.4.0",
 "react": "^16.4.0",
 "prop-types": "^15.6.2",
ljharb commented 6 years ago

This should be fixed by #183

ljharb commented 5 years ago

Fixed.