Comments (10)
This was an intentional breaking change inprop-types
itself (as it is a completely new package) but I didn’t fully realize we switched React 15.5 to actually use the prop-types
(and thus trigger the error).
We need to put out a fix for this asap, thanks for reporting.
from prop-types.
Fixed in [email protected]
.
from prop-types.
Codepen: http://codepen.io/franjohn21/pen/Wjeemd
from prop-types.
If I'm reading the docs correctly, this functionality should throw an error in a future major release.
In a future major release of React, the code that implements PropType validation functions will be stripped in production. Once this happens, any code that calls these functions manually (that isn't stripped in production) will throw an error.
So throwing an error now is unintentional and breaks production builds particularly where 3rd party libraries manually called proptype functions.
from prop-types.
This seems to be an intentional design choice. From the readme in this repo:
In production, all validator functions are replaced with empty functions that throw an error. This is done to optimize the bundle size.
I suspect the reasoning is that proptype checks are usually only done in development. However, I wonder why it doesn't just become a no-op in production, rather than throwing 😕
from prop-types.
Maybe @acdlite or @gaearon can shed some light on why prop-types
is throwing in production before the next major React release.
from prop-types.
This is fixed in [email protected]
and we'll update React 15.x to enforce depending on it soon.
In the meantime you should be able to run rm -rf node_modules
and npm install
to fix this.
from prop-types.
In case anyone is confused, the intended behavior is explained here:
I verified that [email protected]
restores the old behavior for React.PropTypes
, fixing the [email protected]
problem.
from prop-types.
from prop-types.
Thanks 😄 I keep typing that for some reason
from prop-types.
Related Issues (20)
- `.elementType` incompatible with `React.ElementType` HOT 5
- Latest version of prop-types is having vulenrability.Any idea that which safer version shall I switch to? HOT 2
- v15.8.0 breaks `PropTypes.shape({...})` for objects and class-instances. HOT 11
- 15.8.0: `checkPropTypes` sometimes throws: Cannot read properties of undefined (reading 'hasOwnProperty') HOT 11
- Children required prop-types fire warning on create HOT 5
- Update to @babel/preset-react7.10.1 HOT 3
- _propTypes.default.shapeOf is not a function HOT 1
- Potential isRequired bug in v15.8.0 and above HOT 10
- TypeError: Cannot destructure property 'checkPropTypes' as it is undefined. HOT 2
- error (checkPropTypes is not a function) while using with sveltekit HOT 1
- Accidental issue creation, apologies
- Failed prop type: Converting circular structure to JSON when stringifying React jsx HOT 6
- Conditional prop for value another prop HOT 2
- Error : `_propTypes2.default.oneOfType is not a function` HOT 2
- `oneOfType()` does not seem to allow all types specified HOT 2
- SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED HOT 1
- Importing a reference to PropTypes as opposed Proptypes directly HOT 4
- List transitive failures on failure of oneOfType
- The `prop-types` package import is not suddenly recognized when running jest HOT 6
- Update prop-types Version | Severity: high HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prop-types.