-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[core] Extract classes descriptions from TypeScript #25933
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Apr 27, 2021
github-actions
bot
removed
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Apr 28, 2021
It'll be ignored by `react-docgen` anyway
github-actions
bot
added
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Apr 29, 2021
eps1lon
commented
May 10, 2021
@@ -94,7 +94,7 @@ describe('typescript-to-proptypes', () => { | |||
}); | |||
|
|||
if (fs.existsSync(outputPath)) { | |||
expect(propTypes.replace(/\r?\n/g, '\n')).to.include( | |||
expect(propTypes.replace(/\r?\n/g, '\n')).to.equal( |
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.
Better failure message due to displaying a diff. include
does not "include" a diff in the failure message.
github-actions
bot
removed
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
May 10, 2021
Let api object decide whether we want to document classes customization
Merging since there isn't much any changes to the documentation (the order for internal pickers components are for now ignored). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Will not remove the runtime classes descriptions in this PR for reviewability. I'll remove them in a follow-up.
Originally we extracted these descriptions from the runtime code e.g.
For components using emotion that approach no longer worked. Instead, we parsed the AST of the TypeScript declaration files.
Relying on the AST is generally brittle since it breaks every time we change the pattern. Instead, we can rely on the TS type-checker (can re-use
typescript-to-proptypes
resulting in a significantly simplerdocs:api
implementation). This has the benefit of giving us a single approach that doesn't care about where the classes are located. It will document the same thing a dev will see when writing the code and looking at IntelliSense.This revealed a couple of excess declared classes that have no effect at runtime (#25917) and missing classes (upcoming PR). You'll notice these issues in the current state of the PR.
Requires #25917
Required for #25754