-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: fix imported types not showing up in docs #667
docs: fix imported types not showing up in docs #667
Conversation
7b9e403
to
70118eb
Compare
@@ -35,7 +35,8 @@ module.exports = function getReactDoc(source, fileName, error) { | |||
reactDocgen.resolver.findAllExportedComponentDefinitions, | |||
null, | |||
{ | |||
filename: fileName | |||
filename: fileName, | |||
importer: reactDocgen.importers.makeFsImporter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new upcoming feature of react-docgen
allows us to operate on imported types as well.
@@ -124,7 +124,7 @@ | |||
"html-webpack-plugin": "^4", | |||
"jsdoc-api": "^6.0.0", | |||
"mkdirp": "^1", | |||
"react-docgen": "^5", | |||
"react-docgen": "^6.0.0-alpha.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new importer feature is not fully released in production yet, but according to the maintainers of the repo v6 won't contain any breaking changes, so it seems like a safe thing for us to use the pre-release version of the lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The yarn.lock is missing, please add it :) I couldn't find any problems with it, the View props display correctly now, and it could recognise the "query" and "props" prop of Responsive as "object" (typeof this and that) too. Well, it cannot go deeper than one level, but that's why we need that type-linking ticket too :)
@@ -124,7 +124,7 @@ | |||
"html-webpack-plugin": "^4", | |||
"jsdoc-api": "^6.0.0", | |||
"mkdirp": "^1", | |||
"react-docgen": "^5", | |||
"react-docgen": "^6.0.0-alpha.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The yarn.lock is missing, please add it :) I couldn't find any problems with it, the View props display correctly now, and it could recognise the "query" and "props" prop of Responsive as "object" (typeof this and that) too. Well, it cannot go deeper than one level, but that's why we need that type-linking ticket too :)
This PR fix the issue with our current solution for importing propTypes and TS types not showing up in the documentation.
It uses an upcoming feature of
react-docgen
, thus I bumped its version from 5 to 6.alphaFor more info: reactjs/react-docgen#352