-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
add typescript docs #3361
add typescript docs #3361
Conversation
cc @danielduan |
## Using Your Existing Config | ||
|
||
You may have an existing Webpack config for your project. So, you may need to copy and paste some config items into Storybook's custom Webpack config file. | ||
|
||
But you don't need to. There are a few options: | ||
|
||
- Simply import your main Webpack config into Storybook's `webpack.config.js` and use the loaders and plugins used in that. | ||
- Create a new file with common Webpack options and use it in both inside the main Webpack config and inside Storybook's `webpack.config.js`. | ||
* Simply import your main Webpack config into Storybook's `webpack.config.js` and use the loaders and plugins used in that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this Simply?
. If it's so simple, users wouldn't need to read the docs.
It should just say Import your main Webpack...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hahaha i didnt write that
@@ -19,19 +19,19 @@ Let's say you want to add [SASS](http://sass-lang.com/) support to Storybook. Th | |||
Simply add the following content to a file called `webpack.config.js` in your Storybook config directory (`.storybook` by default ). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with this Simply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hahaha i didnt write that
|
||
```bash | ||
yarn add -D typescript | ||
yarn add -D awesome-typescript-loader # alternative to ts-loader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these two loaders interchangeable in this guide? we should leave a note about it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
|
||
## Setting up Typescript to work with Storybook | ||
|
||
We first have to use the [custom Webpack config in full control mode, extending default configs](https://storybook.js.org/configurations/custom-webpack-config/#full-control-mode--default): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think relative URLs work here, so /configurations/custom...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
||
## Related Issues and Helpful Resources | ||
|
||
* [Issue: Add proper typescript webpack setup in readme #1778](https://github.com/storybooks/storybook/issues/1778) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave these GitHub issues out of the docs. It's a lot of stuff to read through to get very little information. If you think there are useful information there, please copy and paste them to the doc instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, really appreciate it! Just some minor fixes and we're good to go.
Codecov Report
@@ Coverage Diff @@
## master #3361 +/- ##
=======================================
Coverage 36.82% 36.82%
=======================================
Files 458 458
Lines 10033 10033
Branches 905 908 +3
=======================================
Hits 3695 3695
+ Misses 5793 5792 -1
- Partials 545 546 +1
Continue to review full report at Codecov.
|
I have updated with your requested fixes |
In the tsconfig.json section, you've buried the lede: the main copy/paste content should work for the default configuration, where |
@tsiq-swyx This is absolutely epic! Thank you a ton 🙇 When my batch of stickers arrive, I'm sending you some, contact me via twitter or slack to send me your address, if you'd like them 👍 |
oh haha cant say no to that. twitter it is |
(not at all urgent, just curious) Whats the process for this being deployed to the live docs site? you guys dont use netlify for CD? |
We deploy from release branch to avoid confusion, so I'll just pick this pr there now, and it'll be deployed authomatically |
Issue: #3270
What I did
Added typescript docs
How to test
its just docs :)