qmhc / vite-plugin-dts

A Vite plugin for generating `.d.ts` files.
MIT License
1.22k stars 84 forks source link

Volar generated type been added #354

Closed RayGuo-ergou closed 1 month ago

RayGuo-ergou commented 1 month ago

Describe the bug

Volar generated types like __VLS_Element will be declared in built files.

This happens on version ^4.0.0 I am guessing it's caused by upgrading vue-tsc?

This will cause type conflict when import the library.

Reproduction

https://github.com/RayGuo-ergou/dts-reproduction

Steps to reproduce

  1. Clone the repo
  2. Open this file or run build

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 7800X3D 8-Core Processor
    Memory: 42.63 GB / 46.66 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 20.15.0 - /usr/local/bin/node
    npm: 10.7.0 - /usr/local/bin/npm
    pnpm: 9.6.0 - /usr/local/bin/pnpm
    bun: 1.0.26 - ~/.bun/bin/bun
  npmPackages:
    @vitejs/plugin-vue: ^5.0.5 => 5.0.5
    vite: ^5.3.4 => 5.3.4
    vite-plugin-dts: 4.0.0-beta.1 => 4.0.0-beta.1

Validations

qmhc commented 1 month ago

Could you provide what type conflict will be caused?

RayGuo-ergou commented 1 month ago

Error:

Definitions of the following identifiers conflict with those in another file: VLS_IntrinsicElements, __VLS_Element, VLS_GlobalComponents, VLS_IsAny, __VLS_PickNotAny, VLS_intrinsicElements, VLS_SelfComponent, __VLS_WithComponent, VLS_FunctionalComponentProps, VLS_UnionToIntersection, __VLS_OverloadUnionInner, VLS_OverloadUnion, VLS_ConstructorOverloads, __VLS_NormalizeEmits, VLS_PrettifyGlobal [6200]

This conflict because these types are auto-generated by the Volar language server. When a library declares same types, it results in naming conflicts.

DerYeger commented 1 month ago

This issue is still present with 4.0.0-beta.2 and the above reproduction.

While certainly not minimal, I also have an end-to-end reproduction of the issue. See https://github.com/DerYeger/yeger/actions/runs/10174119328/job/28139332486#step:4:1227.