
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
prop-types-docs
Advanced tools
yarn add prop-types-docs
npm install prop-types-docs
const MyComponent = ({ name, age, contacts }) => {
<div>
name: {name}
age: {age}
contacts: {contacts.map(() => ...)}
</div>
}
import PropTypes, { withPropDocs } from 'prop-types-docs'
export default withPropDocs({
name: 'MyComponent', // optional
props: {
name: {
type: PropTypes.string,
required: true,
description: "The user's name",
},
age: {
type: PropTypes.number,
required: true,
description: "The user's age",
},
contacts: {
type: PropTypes.array,
default: [],
description: 'A list of contacts',
},
},
})(MyComponent)
import PropTypes from 'prop-types'
MyComponent.displayName = 'MyComponent'
MyComponent.propTypes = {
name: PropTypes.string.isRequired,
age: PropTypes.number.isRequired,
contacts: PropTypes.array,
}
MyComponent.defaultProps = {
contacts: [],
}
prop-types-docs
is not a higher order component. It simply assigns the .propTypes
and .defaultProps
on the provided component. This also allows it to be used anywhere in a compose chain.
In addition to setting the prop types, it also stores the props
meta object on the .propInfo
key on the provided component.
Better support for complex proptypes, e.g. arrayOf(shape())
.
FAQs
### Document your prop types!
The npm package prop-types-docs receives a total of 308 weekly downloads. As such, prop-types-docs popularity was classified as not popular.
We found that prop-types-docs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.