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

fix: types in exports #13443

Merged
merged 2 commits into from
Jul 6, 2023
Merged

fix: types in exports #13443

merged 2 commits into from
Jul 6, 2023

Conversation

zhuying547
Copy link
Contributor

@zhuying547 zhuying547 commented Jul 1, 2023

closed #11818

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

Description

[TypeScript] Fix TypeScript compilation error caused by import {ElButton} from 'element-plus'

🤖 Generated by Copilot at da01901

Add types field to es modules export map in package.json. This improves TypeScript support and compatibility for element-plus library.

Related Issue

Fixes #11818.

Explanation of Changes

I encountered a TypeScript compilation error when the 'moduleResolution' option in tsconfig.json was set to 'bundler'. The specific error message I received was "TypeScript error TS2614: Module 'element-plus' has no exported member 'ElButton'".

After investigating the issue, I discovered that the error was due to the module resolution strategy specified in the tsconfig.json file. When 'moduleResolution' is set to 'bundler', TypeScript expects the bundled module files to be provided, which may not be the case for the 'element-plus' library.

🤖 Generated by Copilot at da01901

  • Add types field to export map for es modules, enabling TypeScript users to import them with type checking and intellisense (link)

@pull-request-triage
Copy link

👋 @zhuying547, seems like this is your first time contribution to element-plus.

  • Please make sure that you have read our guidelines and code of conduct before making a contribution.
  • You can comment with /label Components:[component_name] to add a label for which component you are working on.
  • You may join our Discord for staying tuned.

@pull-request-triage pull-request-triage bot added 1st contribution Their very first contribution Needs Review labels Jul 1, 2023
@github-actions
Copy link

github-actions bot commented Jul 1, 2023

@github-actions
Copy link

github-actions bot commented Jul 1, 2023

Hello @zhuying547, thank you for contributing to element-plus, please see our guideline to see how to make contribution

@github-actions
Copy link

github-actions bot commented Jul 3, 2023

🧪 Playground Preview: https://element-plus.run/?pr=13443
Please comment the example via this playground if needed.

@btea btea requested a review from a team July 3, 2023 01:59
@sxzz sxzz changed the title fix(element-plus): fix TypeScript error caused by moduleResolution fix: types in exports Jul 6, 2023
@sxzz sxzz merged commit 75ab3af into element-plus:dev Jul 6, 2023
10 checks passed
@element-bot element-bot mentioned this pull request Jul 14, 2023
3 tasks
consultation-applio pushed a commit to consultation-applio/element-plus that referenced this pull request Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants