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

(documentation) Add a "troubleshooting" section to typescript.md #14965

Closed
wants to merge 1 commit into from
Closed

Conversation

Offirmo
Copy link

@Offirmo Offirmo commented May 17, 2021

Hi, I had trouble setting up TypeScript support and had to search a lot to make it work. (credits to #14118)

This should help the next one!

Issue:

Not able to have TypeScript checks

What I did

Added documentation

How to test

Not needed

Hi, I had trouble setting up TypeScript support and had to search a lot to make it work.

This should help the next one!
@Offirmo Offirmo requested review from ndelangen and shilman as code owners May 17, 2021 22:57
@nx-cloud
Copy link

nx-cloud bot commented May 17, 2021

Nx Cloud Report

CI ran the following commands for commit 8bb12fe. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

@shilman shilman added documentation patch:yes Bugfix & documentation PR that need to be picked to main branch typescript labels May 18, 2021
@ndelangen ndelangen requested a review from jonniebigodes May 18, 2021 10:03
@jonniebigodes
Copy link
Contributor

@Offirmo sorry for not addressing this sooner. I'll take a look at it tomorrow and work with you on any proposed changes.

Stay safe

Copy link
Contributor

@jonniebigodes jonniebigodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Offirmo left a couple of items that need a bit of polish, let me know once you address them and we'll go from there.

Stay safe

Comment on lines +66 to +77

If storybook is not picking up TypeScript errors, ensure:
* you have a `tsconfig.json` ([ref](https://github.com/storybookjs/storybook/issues/14118#issuecomment-794698889))
* `tsconfig.json` is properly including your files, including `*.tsx`. Example: `"include": [ "stories/**/*" ]`
* Eventually, run with additional traces: `DEBUG=docgen:include,docgen:exclude yarn storybook` to check if your files are properly processed

If react docgen is not generating doc based on types, ensure:
* TypeScript is properly configured (see above)
* You don't have TypeScript errors

If using React, if you need help to properly type your components, this site may help: https://react-typescript-cheatsheet.netlify.app/
Copy link
Contributor

@jonniebigodes jonniebigodes Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Offirmo we have a bit of improvement here we can probably go with:

### Troubleshooting

If you run into issues with TypeScript and Storybook, ensure that:

- Your project contains a `tsconfig.json` file at the root level
- `tsconfig.json` is set up to handle Typescript files (e.g., `"include": [ "stories/**/*.tsx" ]`)
- Follow the [debugging instructions](https://github.com/hipstersmoothie/react-docgen-typescript-plugin#debugging) to check if the story files are processed

<div class="aside">
 💡 <strong>Note:</strong> If you need help setting up TypeScript in your project, check the <a href="https://www.typescriptlang.org/">Typescript docs</a>.
</div>

The reasoning behind this is that we can shorten the section and prevent repetition. Thus making the documentation a bit more streamlined.

@@ -2,7 +2,7 @@
title: 'TypeScript'
---

Storybook has built-in Typescript support, so your Typescript project should work with zero configuration needed.
Storybook has built-in Typescript support, so your Typescript project should work with zero configuration needed. The config files from `.storybook` can be in TypeScript as well.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Offirmo if you could revert back to what's currently documented we'd appreciate it. The reasoning behind this is that in the first sentence we're mentioning that Storybook as a whole has Typescript support, despite the config files being created with .js extension.

@jonniebigodes
Copy link
Contributor

@Offirmo just a friendly reminder if you're willing to work on this pull request. So that the changes you're introducing will help not only you but the rest of the community.

Let me know and we'll go from there. Sounds good?

Stay safe

@jonniebigodes
Copy link
Contributor

@Offirmo closing this for now as the documentation was recently updated! Feel free to reach out to me or open a pull request and ping me and we'll go from there.

Have a great week!

Stay safe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation patch:yes Bugfix & documentation PR that need to be picked to main branch typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants