Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Vue 2, assignment errors in template blocks are not displayed with vue-tsc but displayed with Volar #1372

Closed
mascii opened this issue Jun 1, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@mascii
Copy link

mascii commented Jun 1, 2022

Sample repo: https://github.com/mascii/volar-and-vue-tsc-testing-on-vue-2

An assignment error in the template block is displayed on VSCode with Volar:
volar

But, not displayed by executing npx vue-tsc --noEmit (Currently, the latest version is 0.35.2).

$ npx vue-tsc --noEmit
src/App.vue:4:32 - error TS2339: Property 'value' does not exist on type 'number'.

4     <div>count.value: {{ count.value }}</div>
                                 ~~~~~

src/App.vue:13:7 - error TS2322: Type '1' is not assignable to type '0'.

13 const x: 0 = 1;
         ~


Found 2 errors in the same file, starting at: src/App.vue:4

I've tried some vue-tsc versions, I found no problem with vue-tsc@0.33.9:

$ npx vue-tsc@0.33.9 --noEmit
src/App.vue:4:32 - error TS2339: Property 'value' does not exist on type 'number'.

4     <div>count.value: {{ count.value }}</div>
                                 ~~~~~

src/App.vue:6:35 - error TS2322: Type 'string' is not assignable to type 'number'.

6     <button type="button" @click="count = '100'">set '100'</button>
                                    ~~~~~

src/App.vue:13:7 - error TS2322: Type '1' is not assignable to type '0'.

13 const x: 0 = 1;
         ~


Found 3 errors in the same file, starting at: src/App.vue:4
@johnsoncodehk johnsoncodehk added the bug Something isn't working label Jun 1, 2022
@mascii
Copy link
Author

mascii commented Jun 2, 2022

I have confirmed this issue was resolved in vue-tsc 0.36.0. Thanks for the lighting fast response!

$ npx vue-tsc@0.36.0 --noEmit
src/App.vue:4:32 - error TS2339: Property 'value' does not exist on type 'number'.

4     <div>count.value: {{ count.value }}</div>
                                 ~~~~~

src/App.vue:6:35 - error TS2322: Type 'string' is not assignable to type 'number'.

6     <button type="button" @click="count = '100'">set '100'</button>
                                    ~~~~~

src/App.vue:13:7 - error TS2322: Type '1' is not assignable to type '0'.

13 const x: 0 = 1;
         ~


Found 3 errors in the same file, starting at: src/App.vue:4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants