You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wish this project would just use typescript to parse typescript as the old project react-docgen-typescript did. Why? Because we try to upgrade our design-system to use this new package "react-docgen" but we're already missing some core features.
A union type definition like the following is not parsed correctly:
The two props "children" and "icon" are missing in the result. Parsing the same thing with react-docgen-typescript would indeed find the two props, so i would expect the following output:
But i'm also wondering why the official babel parser typescript plugin can't handle that case?
Update: A short test with babel parser itselfs shows me that babel indeed is parsing this case correctly and all information would be available to produce the expected result. It is just not implemented in this package.
Update 2: I'm working on a PR and it seems to be quite promising - the complex intersection case with multiple interfaces is working now, i had to modify the "handleTSIntersectionType" function and add the missing "handleTSParenthesizedType". Now only the types are getting in my way and i destroyed some existing cases with intersection.... still working on it, hopefully next week i can present a fix :)
The text was updated successfully, but these errors were encountered:
rvetere
changed the title
babel parser plugin "typescript" does not behave like typescript compiler
Mo support for typescript intersection and parenthesized types
May 30, 2024
I wish this project would just use typescript to parse typescript as the old project
react-docgen-typescript
did. Why? Because we try to upgrade our design-system to use this new package "react-docgen" but we're already missing some core features.A union type definition like the following is not parsed correctly:
Result
The two props "children" and "icon" are missing in the result. Parsing the same thing with react-docgen-typescript would indeed find the two props, so i would expect the following output:
Expected
But i'm also wondering why the official babel parser typescript plugin can't handle that case?
Update: A short test with babel parser itselfs shows me that babel indeed is parsing this case correctly and all information would be available to produce the expected result. It is just not implemented in this package.
Update 2: I'm working on a PR and it seems to be quite promising - the complex intersection case with multiple interfaces is working now, i had to modify the "handleTSIntersectionType" function and add the missing "handleTSParenthesizedType". Now only the types are getting in my way and i destroyed some existing cases with intersection.... still working on it, hopefully next week i can present a fix :)
The text was updated successfully, but these errors were encountered: