-
-
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
Core: Zero-config TypeScript loading #10813
Conversation
0d7b7fe
to
c918123
Compare
This is awesome stuff! 🙌 |
c918123
to
8310948
Compare
I added a component to the vue-kitchensink using typescript (pushed to your branch on @shilman's request). Seems to work fine 👍 I'm also testing this with a vue-cli+babel+ts project of mine and running into some problems there, will do some more tests and report back later today! |
Fix react-docgen handling in zero-config typescript preset
ProblemThere seems to be a performance regression that's causing cypress to fail. Some numbers from a month ago:
Next (today)
This branch
SolutionThere are a couple different issues here.
Worked with @mrmckeb on a tentative solution, which is to exclude ArgTypes that come from As a secondary issue, worked on #10373 with @tmeasday to reduce the data sent over the channel by "normalizing" story parameters (e.g. sending component-level parameters once per component rather than once per story). The benefits of that work are only being partially realized, and will follow up in a separate issue: #10844 |
export const createBabelLoader = (options, framework) => ({ | ||
test: useBaseTsSupport(framework) ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/, |
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 is a problem?
FYI I'm merging this with unaccepted Chromatic baselines because I want to get it out ASAP but also want to work through the changes one by one. |
* | ||
* @example `['./src/*.stories.(j|t)sx?']` | ||
*/ | ||
stories: string[]; |
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.
@ndelangen stories can be a function returning an array of strings right?
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.
If that's possible, we can add that @ndelangen @shilman :)
I'm hoping this is temporary @matheo, as this would be exported differently once we convert core to TS.
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.
All preset properties can be a T | (T, Options) => T | (T, Options) => Promise<T>
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.
@ndelangen That applies to addons
and stories
?
Specifically we're looking at the options here: https://github.com/storybookjs/storybook/blob/next/lib/core/types/index.ts#L8-L32
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.
addons
& presets
are the exception.
they are: string[]
.
everything else is T | (T, Options) => T | (T, Options) => Promise<T>
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.
the technical reason is, as we "discover" presets/addons, we don't know the whole list yet, and so we can't pass it in. I figured it'd be too complex and confusing for presets to receive an incomplete list of presets.
This PR undo the work that have been done in previous pull requests to increase the performance of docgen and it breaks compatibility with "path alias" that worked in previous versions. This plugin is the issue: react-docgen-typescript-loader #7998 |
@RuneKR please read about the rationale for the change here: if you want to use the old settings, you can do that by setting |
Issue: #10790 #4475
What I did
Added support for TypeScript to the core of Storybook.
Vue support based on: storybookjs/presets#122.
How to test
Projects should work with TypeScript with zero config.