Skip to content

[Bug]Can't not get right type for vue component prop #635

@ishowman

Description

@ishowman

Describe the bug

When I do not install unplugin-vue-components:

  • volar could know that msg prop should be string but not number;
    image
  • pnpm build could get the same error type info

After install unplugin-vue-components, and add comment for import statement:

  • the error disappear, and volar tells me msg prop is number
    image
  • pnpm build succeed and no error info
  • If I remove comment for import statement, it behaves as screenshot1 even component.d.ts still declare HelloWorld component

HelloWorld.vue is created by create vue, I didn't change any codes.

I am not sure the bug is caused by unplugin-vue-components or vue-tsc, please check it.

how i create the repo

  • init with create-vue to create project
  • install unplugin-auto-import, here is the code diff
  • install unplugin-vue-components, here is the code diff)

Reproduction

https://github.com/ishowman/vue3-ts-buiild-bug/tree/vue-components

System Info

Plugins: (already finish setup with volar-takeover-mode)

  • Vue Language Features (Volar):v1.6.4
  • TypeScript Vue Plugin (Volar):v1.6.5
pnpm: 8.5.1
node: 18.12.1


 System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
    Memory: 1.97 GB / 7.86 GB
  Binaries:
    Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (113.0.1774.50)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions