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

add typescript docs #3361

Merged
merged 4 commits into from
Apr 5, 2018
Merged

add typescript docs #3361

merged 4 commits into from
Apr 5, 2018

Conversation

tsiq-swyx
Copy link
Contributor

Issue: #3270

What I did

Added typescript docs

How to test

its just docs :)

@tsiq-swyx
Copy link
Contributor Author

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.
Copy link
Member

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...

Copy link
Contributor Author

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 ).
Copy link
Member

Choose a reason for hiding this comment

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

same with this Simply

Copy link
Contributor Author

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
Copy link
Member

@danielduan danielduan Apr 5, 2018

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.

Copy link
Contributor Author

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):
Copy link
Member

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...

Copy link
Contributor Author

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)
Copy link
Member

@danielduan danielduan Apr 5, 2018

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.

Copy link
Member

@danielduan danielduan left a 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
Copy link

codecov bot commented Apr 5, 2018

Codecov Report

Merging #3361 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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
Impacted Files Coverage Δ
addons/a11y/src/components/Tabs.js 0% <0%> (ø) ⬆️
...-native/src/preview/components/OnDeviceUI/index.js 0% <0%> (ø) ⬆️
.../ui/components/stories_panel/stories_tree/index.js 40.55% <0%> (ø) ⬆️
lib/ui/src/modules/ui/containers/addon_panel.js 23.52% <0%> (ø) ⬆️
addons/jest/src/components/Indicator.js 0% <0%> (ø) ⬆️
addons/info/src/components/types/proptypes.js 88.88% <0%> (ø) ⬆️
lib/ui/src/libs/withLifecycleDecorator.js 18.91% <0%> (ø) ⬆️
lib/ui/src/modules/ui/configs/init_panels.js 25% <0%> (ø) ⬆️
lib/core/src/client/preview/config_api.js 46.55% <0%> (ø) ⬆️
addons/jest/src/components/Result.js 0% <0%> (ø) ⬆️
... and 57 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 119d16c...3925edd. Read the comment docs.

@tsiq-swyx
Copy link
Contributor Author

I have updated with your requested fixes

@estaub
Copy link

estaub commented Apr 5, 2018

In the tsconfig.json section, you've buried the lede: the main copy/paste content should work for the default configuration, where stories is a peer of src. The main takeaway there (I think) is to be sure to include the stories; this shouldn't be only in an easily-overlooked sentence below the code.

@tsiq-swyx
Copy link
Contributor Author

I also wrote this https://dev.to/swyx/quick-guide-to-setup-your-react--typescript-storybook-design-system-1c51

@ndelangen
Copy link
Member

@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 👍

@tsiq-swyx
Copy link
Contributor Author

oh haha cant say no to that. twitter it is

@ndelangen ndelangen merged commit 5c84288 into storybookjs:master Apr 5, 2018
@swyxio
Copy link
Contributor

swyxio commented Apr 6, 2018

(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?

@Hypnosphi Hypnosphi added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Apr 6, 2018
@Hypnosphi
Copy link
Member

We deploy from release branch to avoid confusion, so I'll just pick this pr there now, and it'll be deployed authomatically

Hypnosphi pushed a commit that referenced this pull request Apr 6, 2018
@Hypnosphi Hypnosphi added the patch:done Patch/release PRs already cherry-picked to main/release branch label Apr 6, 2018
@Hypnosphi
Copy link
Member

And it's live https://storybook.js.org/configurations/typescript-config/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: info documentation patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch react typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants