proptypes-to-ts-declarations's People
Forkers
book777proptypes-to-ts-declarations's Issues
Does not parse enum numbers correctly
react-docgen
parses enums incorrectly,
Heading.propTypes = {
size: size: PropTypes.oneOf([1, 2, 3])
}
is parsed as:
"type": {
"name": "enum",
"value": [
{ "value": "1", "computed": false },
{ "value": "2", "computed": false },
{ "value": "3", "computed": false },
]
}
=
type headingSizeEnum = "1" | "2" | "3";
losing the information about the type of values inside the enum
It might make sense to add a custom resolver for enums to identify number from string?
const isNumber = value => {
const parsedValue = Number(value)
/*
Number("42") => 42
Number("42px") => NaN
We can use isNaN to detect if the parsed value
is not a number
*/
if (isNaN(parsedValue)) return false
return true
}
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.