Skip to content
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

v2.0.0 - Regression in parsing @default #366

Closed
bebraw opened this issue Jun 10, 2021 · 5 comments
Closed

v2.0.0 - Regression in parsing @default #366

bebraw opened this issue Jun 10, 2021 · 5 comments
Labels
bug stale There is no activity for a long time.

Comments

@bebraw
Copy link
Collaborator

bebraw commented Jun 10, 2021

While trying to upgrade react-docgen-typescript-plugin to use v2.0.0 in order to get the .trim() fix in, I discovered a small regression related to parsing @default.

I've set up two repositories for you to check:

Here are some screenshots I took during the investigations:

Screen Shot 2021-06-10 at 11 46 09

Screen Shot 2021-06-10 at 11 46 15

Screen Shot 2021-06-10 at 12 20 24

@shilman
Copy link
Contributor

shilman commented Jun 10, 2021

Thanks @bebraw! Would love to get this into Storybook 6.3 if there's a fix in soon.

@CosticaPuntaru
Copy link

CosticaPuntaru commented Jul 5, 2021

I have a similar issue with @type,
also i was using a custom prop @ignore and propFilter to remove props using it, now the description dose not have any @ related content

@ecraig12345
Copy link
Contributor

This is due to using react-docgen-typescript >= 2 with typescript versions < 4.3 (looks like 3.8 in the react-docgen-typescript-plugin repro branch).

TS 4.3 changes the type of ts.JSDocTagInfo.text from string to ts.SymbolDisplayPart[], which was the cause of the (tag.text || '').trim() is not a function error others reported. #360 fixed that issue by parsing tag text using ts.displayPartsToString, but this broke compatibility with earlier TS versions (and the typescript peer dep has been updated accordingly--so on an earlier TS version, you must use react-docgen-typescript 1.x).

The unfortunate thing is that the changes needed to support both older and newer TS versions are pretty minimal, as shown in this branch commit (the rest of the change is for testing)--so supporting 4.3 didn't actually need to be a breaking change. It's especially unfortunate because this means that if anything using this library (such as storybook) wants to support 4.3, they must also require consumers to upgrade to 4.3, which may not be feasible right away.

I'd be happy to submit a PR from this branch to restore support for older TS if it's not too odd to revert the constraint that prompted a major release. Right now the branch has tests confirming support back to 3.0 but I could change it to not go back quite that far if desired. (My team's project is currently on 4.1.)

@github-actions
Copy link

There was no activity for a long time. The issue will be closed soon.

@github-actions github-actions bot added the stale There is no activity for a long time. label Feb 23, 2022
@github-actions
Copy link

github-actions bot commented Mar 2, 2022

Closing this issue as obsolete.

@github-actions github-actions bot closed this as completed Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug stale There is no activity for a long time.
Projects
None yet
Development

No branches or pull requests

4 participants