Svelte: Fix argTypes inference in Button component #20212
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug in our Svelte renderer components that would mean argTypes were not inferred correctly for the Button component created in TS sandboxes.
#20007 introduces TS specific versions of the sandbox stories, however they missed the fact that sveltedoc-parser doesn't support TypeScript, so argTypes are not inferred from TS types but rather from default values and JSDocs (types being ignored). @kasperpeulen
Therefore, adding a default value will correctly infer it as a string instead of any object.
This error was caught in our E2E tests in CI, because they try to set the text
Hello
on the button but because it was inferred as an object it needed to be JSON"Hello"
to work properly.I don't understand why CI for #20007 was only running 36 E2E tests, and why the daily test as late as 2 days ago ran all 72 E2E tests not failing on this? Maybe @yannbf or @kasperpeulen can share some knowledge about this?