Addon-links: Fix export statement in react.d.ts #17434
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.
Issue: Closes #14539
What I did
The
LinkTo
component is exported using default exportstorybook/addons/links/src/react/index.ts
Lines 1 to 3 in 7064642
which is reflected in the
dist/ts3.9/react/index.d.ts
fileHowever, in the type definition file, we are exporting the component using named export
storybook/addons/links/react.d.ts
Line 2 in 7064642
which causes a TypeScript error in the following code because there is no type definition for
LinkTo
as a default export:To fix the issue, I changed the export statement in
react.d.ts
to use default export.How to test
Tested with
examples/cra-ts-essentials
by addingLinkTo
to a storybook file and confirm that no TS error occurs. Also, the "Go to definition" option should now point us to the correct file where the component's type definition is declared.