Comments (5)
@ljharb yeah that's even better than what I was looking for!
from prop-types.
Since the render callback is just a function, there's no way in pure Javascript to check the type of the return value. A static type checker like Typescript or Flowtype could do this for you, though.
from prop-types.
You may be looking for this feature request: facebook/react#10020
from prop-types.
@tehandyb alternatively, if you accept a thunk as a prop, you need to check its return type at runtime, in the render path.
Separately, the SFC function itself is not an element, it's a Component - <SFC />
is an element. The way I'd validate it is to use it in a jsx/createElement context, and let React handle it.
from prop-types.
This seems answered.
from prop-types.
Related Issues (20)
- 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
- [spam]
- Add a PropType for an exact shape plus "...rest" properties HOT 1
- TS compiler complains when PropTypes property is set externally from the component.propTypes HOT 2
- Can't pass server component to PropTypes.node HOT 6
- Remove object-assign dependency HOT 1
- False positive isRequired validation for never rendered components HOT 1
- Upgrading `defaultProps` to use JavaScript default parameters shows isRequired errors HOT 6
- The requested module '/node_modules/prop-types/index.js?' does not provide an export named 'default' HOT 1
- PropTypes warnings not displaying in Next.js 14 App Router with React 18.3.1 and React Router DOM 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.