Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#1061·vue-echarts

Re-exporting VChart from a library with `declaration: true` fails with TS4023 / TS2742

Author: p-morel-92Created Sep 18, 2026Updated Sep 18, 2026

Confirmation

  • I can confirm this problem is not reproducible with ECharts itself.

How are you introducing Vue ECharts into your project?

ES Module imports

Versions

bash
├── [email protected]
  ├── [email protected]
  ├─┬ [email protected]
  │ ├── [email protected] deduped
  │ └── [email protected] deduped
  └─┬ [email protected]
    └── [email protected] deduped

Details

A library that re-exports the default export (VChart) and emits its own .d.ts with declaration: true fails to compile with [email protected]:

typescript
import VChart from "vue-echarts";
export const MyChart = VChart;
src/index.ts(4,14): error TS2742: The inferred type of 'MyChart' cannot be named without a reference to '../node_modules/vue-echarts/dist/index-BujxhN-1'. This is likely not portable. A type annotation is necessary.
src/index.ts(4,14): error TS4023: Exported variable 'MyChart' has or is using name 'CoordinateSystemDataLayout' from external module ".../node_modules/echarts/types/dist/shared" but cannot be named.
src/index.ts(4,14): error TS4023: Exported variable 'MyChart' has or is using name 'ECActionEvent' from external module ".../node_modules/echarts/types/dist/shared" but cannot be named.
src/index.ts(4,14): error TS4023: Exported variable 'MyChart' has or is using name 'SlotSymbol' from external module ".../node_modules/@vue/runtime-core/dist/runtime-core" but cannot be named.
src/index.ts(4,14): error TS4023: Exported variable 'MyChart' has or is using name 'ZRenderType' from external module ".../node_modules/echarts/types/dist/shared" but cannot be named.

The component type lives in an internal chunk (dist/index-*.d.ts) and is built from PublicComponent, PublicMethods and SlotsTypes, none of which are exported from the package entry point. TypeScript has no public path to name the type, so it tries to inline it and hits non-exported names from echarts and @vue/runtime-core.

Exporting those three types from vue-echarts makes the build pass; the emitted declaration then reads import("vue-echarts").PublicComponent<...>. Proposed fix in #1060.

Reproduction

https://github.com/p-morel-92/vue-echarts-ts4023-repro

Source: ecomfe/vue-echarts

View original on GitHubView discussion on GitHub