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

Addon-links: Fix export statement in react.d.ts #17434

Merged
merged 1 commit into from Feb 7, 2022

Conversation

huyenltnguyen
Copy link
Contributor

Issue: Closes #14539

What I did

The LinkTo component is exported using default export

import LinkTo from './components/link';
export default LinkTo;

which is reflected in the dist/ts3.9/react/index.d.ts file

Screen Shot 2022-02-07 at 10 10 55

However, in the type definition file, we are exporting the component using named export

export { default as LinkTo } from './dist/ts3.9/react';

which causes a TypeScript error in the following code because there is no type definition for LinkTo as a default export:

Screen Shot 2022-02-07 at 10 15 23

To fix the issue, I changed the export statement in react.d.ts to use default export.

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

Tested with examples/cra-ts-essentials by adding LinkTo 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.

@nx-cloud
Copy link

nx-cloud bot commented Feb 7, 2022

☁️ Nx Cloud Report

CI ran the following commands for commit 24d9b9a. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@huyenltnguyen huyenltnguyen changed the title fix(links): correct export statement in react.d.ts fix(addon-links): correct export statement in react.d.ts Feb 7, 2022
Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

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

@huyenltnguyen Thanks a lot for your contribution! Looks great to me!

@shilman shilman changed the title fix(addon-links): correct export statement in react.d.ts Addon-links: Fix export statement in react.d.ts Feb 7, 2022
@shilman shilman merged commit 7b6c83d into storybookjs:next Feb 7, 2022
@shilman shilman added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Feb 7, 2022
@huyenltnguyen huyenltnguyen deleted the fix/link-to branch February 7, 2022 15:39
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Feb 12, 2022
shilman added a commit that referenced this pull request Feb 12, 2022
Addon-links: Fix export statement in react.d.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: links bug 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6.2.5 addon-link - LinkTo - New TypeScript Errors
3 participants