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

[Bug] Some internal types become unavailable when moduleResolution is set to `bundler" #20671

Open
Yupeng-li opened this issue Jan 9, 2025 · 0 comments
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.

Comments

@Yupeng-li
Copy link

Yupeng-li commented Jan 9, 2025

Version

5.6.0

Link to Minimal Reproduction

https://codesandbox.io/p/sandbox/v29fdw

Steps to Reproduce

Previously with the version 5.4.3, we can import internal types, such as ValueAxisBaseOption, DataZoomOption, AreaStyleOption and so on, from files where they are defined.

import { ValueAxisBaseOption } from 'echarts/types/src/coord/axisCommonTypes'

These types are useful when we write unit tests or when we write util functions that customise these options based on certain parameters.

However since 5.6.0 we can no longer do this, because you updated the exports field in package.json and those files are no longer recognisable by typescript.

This might not be a bug, but it does break our type check. As a workaround, I added a patch to export them from /node_modules/echarts/types/dist/echarts.d.ts, so I can import in this way:

import { ValueAxisBaseOption } from 'echarts'

I wonder if you can export them by default, so we get more precise types?

Expected Behavior

Be able to import them

Environment

- OS: macOS sequoia
- Browser: N/A
- Framework: react, react-native

Any additional comments?

Please note that the moduleResolution in our tsconfig is set to bundler. Those types can still be imported if it's set to node. But in our case, we have to use bundler.

@Yupeng-li Yupeng-li added the bug label Jan 9, 2025
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

1 participant