Better support for custom types
See original GitHub issueThis is more of a “would you be willing to accept a pull request which does this?” question than an issue of sorts. 😃
I would really like to extend the functionality of “custom” types so that:
- We support destructured imports (Eg.
PropTypes.array
- note the lack ofReact.
) - We allow common react-esque prop type function patterns to be picked up with custom props in the same way that
arrayOf
is currently handled. (Eg.PropTypes.iterableOf(PropTypes.record(User))
)
Basically I feel the library should be able to support custom user prop types in such a way we don’t have to reparse the raw
value which would mean anyone can easily implement simple custom prop types and create documentation from that.
Custom prop types are super useful in building a real-world app with React and so I would like to see how we can help developers document these too.
We, at Lystable, want to build an open living component docs solution and are hoping react-docgen can feature at the core!
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
add better support for custom types · Issue #1829 - GitHub
right now, to add a new type to pydantic, we have to create a custom class and add validation logic to it. this...
Read more >How To Create Custom Types in TypeScript - DigitalOcean
Though the pre-made, basic types in TypeScript will cover many use cases, creating your own custom types based on these basic types will ......
Read more >Rails 7 adds better support for custom enum types in ...
PostgreSQL provides in-built support for enumerated types that Rails can then take advantage of. However, it is often a pain to make use...
Read more >How to support multiple custom types? - Stack Overflow
When i find a type I convert the string to the appropriate type. However how can i improve this so that is it...
Read more >Custom Types - Open Source by greenrobot
Learn how to add support for a custom types using greenDAO. Custom types allow entities to have properties of any type.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To clarify here are a few examples:
Ex 1. Firstly the destructuring pattern should be supported.
Ex 2. With the above the
[x].isRequired
would be a common pattern we can extract.Ex 3. Custom function prop-types should be supported.
Ex 4. Again,
.isRequired
pattern should be honoured.Ex 5. Function pattern will support nested types.
Ex 6. To confirm, these custom props can be used deeply.
Notes/thoughts:
oneOf
covers any possible usage of this..raw
should still be present on the type objectname: 'custom'
has gone..raw
still exists and consumers can still do the same stuff.customName
property.Ditto. I’m also wondering if this may actually become a plugin in light of #115.