Repository navigation
Conversation
✅ Deploy Preview for react-docgen ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: d8fdfd0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
This file contains hidden or 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
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.
Fixes #925.
Props typed with
Pick<T, K>orOmit<T, K>were dropped. For example,props: Pick<Base, 'a'>produced no props,Omit<Base, 'b'> & { c: boolean }produced onlyc, andinterface Props extends Pick<Base, 'a'>reportedPickincomposes.This adds support when
Kis a string or number literal, or a union of them:Pickkeeps the listed members ofTandOmitdrops them. Descriptions andrequiredcome from the original members.extends, and nested (Omit<Pick<T, 'a' | 'b'>, 'b'>).Pick<Base<string>, 'value'>givesvalue: string.PickorOmitis left alone.Tcannot be resolved (for example it is imported from another package),interface Props extends Pick<LinkProps, 'href'>now addsLinkPropstocomposesinstead ofPick.Omit<T, keyof Other>, behave as before.Implementation notes:
resolveGenericTypeAnnotationnow returns a builtinPick/Omitreference as is, so a type alias such astype Props = Omit<Base, 'c'>still reaches the new code.Pick/Omitis read with its own visited set, soPick<T, 'a'> & Omit<T, 'a'>readsTtwice. To keep cycles safe,applyToTypePropertiesalso tracks the types on the current path (a new optionalancestorsargument). Everything else keeps the existing visited set, so output for other types is unchanged.Tests: added 12 cases to
codeTypeHandler-test.ts. Without the change, 10 of them fail. The other 2 (aPickof the interface that extends it, and a localtype Pick) guard against regressions. The fullreact-docgensuite passes (1526 tests), along withtsc, ESLint and Prettier.