language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Missing components type with `vue-facing-decorator`

Open matteoscaramuzza opened this issue 1 year ago • 10 comments

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

matteoscaramuzza avatar Aug 29 '24 14:08 matteoscaramuzza

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.

basil avatar Aug 29 '24 20:08 basil

@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?

davidmatter avatar Aug 29 '24 22:08 davidmatter

@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.

matteoscaramuzza avatar Aug 30 '24 06:08 matteoscaramuzza

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.

juanparati avatar Aug 30 '24 08:08 juanparati

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.

basil avatar Sep 01 '24 17:09 basil

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

KazariEX avatar Sep 02 '24 06:09 KazariEX

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.

alecgibson avatar Sep 02 '24 09:09 alecgibson

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

basil avatar Sep 06 '24 14:09 basil

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.

KazariEX avatar Sep 06 '24 14:09 KazariEX

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).

basil avatar Sep 06 '24 18:09 basil