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

feat: Add initial TypeScript autocomplete support #35

Merged
merged 5 commits into from Dec 18, 2018

Conversation

@markdalgleish
Copy link
Member

commented Dec 6, 2018

Before starting webpack, if we detect a tsconfig.json file, we now use react-docgen-typescript to parse the prop types of all React components in the current working directory. For now, only string prop values are supported. On a component-by-component basis, we use the static types if they're available, otherwise we fall back to the existing strategy via parse-prop-types.

There aren't any automated tests for this, but I've added a TypeScript example for manual testing. I've added a Cypress test for the existing autocomplete behaviour to ensure that we haven't regressed.

In order to test this automatically, we'll need to improve our test suite to support multiple test projects, but I'm happy to leave that for another PR.

@hipstersmoothie

This comment has been minimized.

Copy link

commented Dec 6, 2018

Works great 🎉

screen shot 2018-12-06 at 1 02 23 am

@hipstersmoothie

This comment has been minimized.

Copy link

commented Dec 6, 2018

One thing you might want to add is the ability to configure react-dogen-typescript's config. https://github.com/styleguidist/react-docgen-typescript#parseroptions

In my storybook i use that to exclude the HTML attributes using propFilter.

@markdalgleish

This comment has been minimized.

Copy link
Member Author

commented Dec 6, 2018

@hipstersmoothie I might look into something like this as a follow-up PR.

markdalgleish added some commits Dec 6, 2018

@DavidHooper

This comment has been minimized.

Copy link
Contributor

commented Dec 13, 2018

Looks great, any ETA on when this will be released?

lib/getStaticTypes.js Show resolved Hide resolved
lib/getStaticTypes.js Outdated Show resolved Hide resolved
@jackhurley23
Copy link
Contributor

left a comment

Looks good!

@markdalgleish markdalgleish merged commit 39046d7 into master Dec 18, 2018

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
pullapprove 1 group approved
Details

@markdalgleish markdalgleish deleted the typescript-autocomplete branch Dec 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.