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

Typescript errors in non typescript vue file #34

Closed
humpangle opened this issue Aug 23, 2021 · 9 comments
Closed

Typescript errors in non typescript vue file #34

humpangle opened this issue Aug 23, 2021 · 9 comments

Comments

@humpangle
Copy link

Thanks for this project - it works in great for typescript project. I have a non typescript .vue file and now that I upgraded to coc-volar 0.5.10 I started getting typescript errors such as

[ts 2322] [E] Type '() => void' is not assignable to type 'never'.

mostly in callback props. How can I resolve this? Thanks.

@yaegassy
Copy link
Owner

Does this problem also occur with VSCode's volar extension?

If possible, could you please provide the smallest code sample you can reproduce?


If downgrading the version of coc-volar temporarily solves your problem, please give it a try.

:CocUninstall @yaegassy/coc-volar
:CocInstall @yaegassy/coc-volar@0.5.9

@humpangle
Copy link
Author

Thanks for the response. Downgrading to 0.5.9 did make the errors go away, but then there is no longer intellisense. You can take a look here https://github.com/humpangle/non-typescript-vue-coc-volar/blob/36d29889a43d7406a803929854f75a794fda93b3/src/components/HelloWorld.vue#L2

You will get errors for both the sayHi callback and the msg prop.

Below are my coc-volar and vue related settings:

  "volar.codeLens.references": false,
  "volar.codeLens.pugTools": false,
  "volar.codeLens.scriptSetupTools": false,
  "volar.formatting.enable": false,
  "prettier.disableLanguages": [],
  "emmet.includeLanguages": {
    "vue-html": "html",
  }

@johnsoncodehk
Copy link
Contributor

Hi @humpangle, please install @vue/runtime-dom for vue 2 project. See https://github.com/johnsoncodehk/volar#using.

@yaegassy
Copy link
Owner

yaegassy commented Aug 24, 2021

By installing @vue/runtime-dom, the error was resolved in my environment. (coc-volar v0.5.10)

@humpangle Did you solve the problem?

Downgrading to 0.5.9 did make the errors go away, but then there is no longer intellisense.

As a side note, coc-volar v0.5.9 (volar v0.27.6) or earlier, required tsconfig.json or jsconfig.json in the project.

@humpangle
Copy link
Author

Thanks @johnsoncodehk and @yaegassy . I have installed @vue/runtime-dom as suggested and that made the errors go away.

But I have found the problem is with @vue/composition-api. If you look at the repo https://github.com/humpangle/non-typescript-vue-coc-volar in commit 624c5f5 where I introduced @vue/composition-api here https://github.com/humpangle/non-typescript-vue-coc-volar/blob/624c5f56abecb53164ba90745a902e6cd6fb4b5c/src/components/Some.vue#L8, then I started getting the same callback error as in my actual project.

Here is the location of the error https://github.com/humpangle/non-typescript-vue-coc-volar/blob/624c5f56abecb53164ba90745a902e6cd6fb4b5c/src/components/HelloWorld.vue#L2.

The error message:

[ts 2322] [E] Type 'any' is not assignable to type 'never'.

@johnsoncodehk
Copy link
Contributor

johnsoncodehk commented Aug 24, 2021

It's seem a bug, please forward @vue/composition-api types issue to @vue/composition-api repo.

@humpangle
Copy link
Author

Thanks @johnsoncodehk. I will do just that right away.

But should I be getting type issues in a non TS project? Apologies if I should have found the answer some where.

@humpangle
Copy link
Author

I have raised the issue with @vue/composition-api. @yaegassy , would you like me to close this issue?

@johnsoncodehk
Copy link
Contributor

Thanks @johnsoncodehk. I will do just that right away.

But should I be getting type issues in a non TS project? Apologies if I should have found the answer some where.

Maybe follow vuejs/language-tools#411.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants