The addition of reactDocgenTypescriptConfig is great! So I started playing around with it, but couldn't get a bunch of my components to work when they referenced types from other .tsx files. After a bunch of digging and red herrings, I found that playroom is not parsing tsconfig.json it is just reading the file as is, meaning things like extends does not work.
Use withCustomConfig and just pass the file path straight to react-docgen-typescript. The issue with this approach however is that noErrorTruncation would not be able to be set.
The addition of
reactDocgenTypescriptConfig
is great! So I started playing around with it, but couldn't get a bunch of my components to work when they referenced types from other.tsx
files. After a bunch of digging and red herrings, I found that playroom is not parsingtsconfig.json
it is just reading the file as is, meaning things likeextends
does not work.The code in question is here: https://github.com/seek-oss/playroom/blob/master/lib/getStaticTypes.js#L31-L34. This just reads in the config, so when using
extends
the other configs being extended are not resolved.There are 2 solutions to this problem I can come up with:
ts.parseJsonConfigFileContent
to properly parse the config. This is whatreact-docgen-typescript
does itself: https://github.com/styleguidist/react-docgen-typescript/blob/master/src/parser.ts#L159withCustomConfig
and just pass the file path straight toreact-docgen-typescript
. The issue with this approach however is thatnoErrorTruncation
would not be able to be set.