Add deprecation status in prop types
install
npm install react-docgen-deprecation-handler --save-dev
what does it do?
You can add @deprecated
in the leading comments for a prop,
and it will appear in the documentation as a key
const Component = <div /> ComponentpropTypes = /** @deprecated dont use this prop */ old: PropTypesany /** this isn't deprecated, use it */ new: PropTypesany /** @deprecated:new deprecated, you can add metadata like the replacement */ old2: PropTypesany
⬇️
displayName: "Component" props: old: type: name: 'any' required: false description: "dont use this prop"👉 deprecated: true new: type: name: 'any' required: false description: "this isn't deprecated, use it" old2: type: name: 'any' required: false description: "dont use this prop"👉 deprecated: true👉 deprecationData: "new"
usage
You can add this handler to react-docgen
's handlers
// grab the deprecation handlerconst deprecationHandler = // add this to docgen's handlersconst handlers = docgendefaultHandlers // pass these handlers to docgen.parseconst data = docgen
like it?
⭐️ this repo
license
MIT © siddharthkp