vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.76k stars 388 forks source link

Missing components type with `vue-facing-decorator` #4748

Open matteoscaramuzza opened 2 weeks ago

matteoscaramuzza commented 2 weeks ago

Vue - Official extension or vue-tsc version

2.1.2

VSCode version

I use WebStorm

Vue version

3.4.38

TypeScript version

5.5.4

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M1
    Memory: 80.02 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.1 - /usr/local/bin/node
    npm: 10.7.0 - /usr/local/bin/npm
    pnpm: 7.13.5 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 128.0.6613.85
    Safari: 17.6

Steps to reproduce

Launch command:
vue-tsc --noEmit --skipLibCheck -p tsconfig.json --composite false

What is expected?

It's expected the build is correctly completed

What is actually happening?

Every reference of custom components in other custom component templates are marked as errors this way:

src/components/partials/ZBaseDatePicker.vue:55:10 - error TS2339: Property 'ZPlainButton' does not exist on type 'Required<{} & __VLS_WithComponent<"ZPlainButton", { "i18n-t": new () => { $props: VNodeProps & TranslationProps; }; "i18n-d": new () => { $props: VNodeProps & DatetimeFormatProps & BaseFormatProps; }; ... 8 more ...; Teleport: { ...; }; } & this, "ZPlainButton", "zPlainButton", "z-plain-button"> & __VLS_WithComponen...'.

55         <z-plain-button

Link to minimal reproduction

No response

Any additional comments?

No response

basil commented 2 weeks ago

Ditto. Upgrading from vue-tsc and @vue/language-core from 2.0.29 to 2.1.0 (and nothing else) results in 283 new TypeScript errors for me. I read the release notes and nothing appears to have changed. What went wrong?

To reproduce, see https://github.com/neanes/neanes/pull/933. Check out that pull request and run npm install && npm run build. The default branch builds correctly.

davidmatter commented 2 weeks ago

@basil https://github.com/facing-dev/vue-facing-decorator seems to be the problem here. @matteoscaramuzza are you using some kind of class component decorator library too?

matteoscaramuzza commented 2 weeks ago

@basil https://github.com/facing-dev/vue-facing-decorator seems to be the problem here. @matteoscaramuzza are you using some kind of class component decorator library too?

Yes, exactly.

juanparati commented 2 weeks ago

I think this issue is related with https://github.com/vuejs/language-tools/issues/4747

BTW: I can reproduce this issue only with 2.1.2 but not with 2.1.0.

basil commented 1 week ago

Hi @davidmatter, I saw that the related PR https://github.com/vuejs/language-tools/pull/4763 was released in 2.1.4. As you can see from the CI build for https://github.com/neanes/neanes/pull/936, this does not resolve the issue and I still get 283 new TypeScript errors with 2.1.4.

KazariEX commented 1 week ago

When using 2.0.X, Can the type of component injected through the decorator be inferred correctly in the template?

alecgibson commented 1 week ago

We're running into this too. I've done some work on vue-facing-decorator before, so I'm happy to help, but I'm afraid I have absolutely no idea about vue-tsc internals or the nature of the break.

If anyone can enlighten me about what exactly needs to change in vue-facing-decorator (if it is a bug that that, not with vue-tsc), I'm more than happy to put together a Pull Request.

basil commented 1 week ago

Is there a plan to either fix this regression or revert the offending change?

KazariEX commented 1 week ago

When using 2.0.X, Can the type of component injected through the decorator be inferred correctly in the template?

I think I need to know the answer to this question first.

basil commented 1 week ago

I do not know the answer to this question and do not even understand the question. I am just a user who is experiencing a regression. If it helps, the issue can be reproduced reliably in neanes/neanes (e.g. https://github.com/neanes/neanes/pull/933 and https://github.com/neanes/neanes/pull/951).