react-docgen-typescript icon indicating copy to clipboard operation
react-docgen-typescript copied to clipboard

expression returned using shouldIncludeExpression is not the original root expression

Open joshwooding opened this issue 3 years ago • 2 comments

When an expression is returned it might be the typeSymbol https://github.com/styleguidist/react-docgen-typescript/blob/1a14c0edc609455a4c2766fa5eec68bc3b902d05/src/parser.ts#L304 which means that we cannot easily get the original root expression from it. Was this intended? I think it would be a lot more powerful if the original root expression was returned which would allow users to pull as much information as needed out of it.

My primary use case for this would be to be able to get default export names using it, which I cannot see an easy way to get this information from the type symbol which refers to the "FunctionComponent" type.

cc @TrevorBurnham

joshwooding avatar May 02 '22 12:05 joshwooding

Hmm, yeah, that certainly sounds like a bug to me. I can put a patch together.

TrevorBurnham avatar May 03 '22 17:05 TrevorBurnham

Hmm, yeah, that certainly sounds like a bug to me. I can put a patch together.

Nice, let me know if you want me to do anything. Thanks for the quick reply :)

joshwooding avatar May 04 '22 13:05 joshwooding