language-tools: Native DOM event type checking error since upgrading to 1.0.3
Native DOM event type checking error. (click, contextmenu, etc.)
vue@3.2.40 vite@3.1.7 vitejs/plugin-vue@3.1.2 vue-tsc@1.0.3 volar@1.0.3
I have deleted and installed yarn.lock + node_modules.
<template>
<div @click="test"></div>
</template>
<script setup lang="ts">
const test = () => {}
</script>
Type ‘() => void’ is not assignable to type ‘MouseEvent’.ts(2322) __VLS_types.ts(107, 56): The expected type comes from property ‘click’ which is declared here on type ‘EventObject<undefined, “click”, {}, MouseEvent | undefined>’
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 28
- Comments: 43 (7 by maintainers)
Commits related to this issue
- fix(build): npm & yarn locked file /r https://github.com/johnsoncodehk/volar/issues/1985 — committed to singcl/XmVideoPlayer by singcl 2 years ago
- fix: fix vue-tsc dom event type error (lock types/node 18.8.0) more see https://github.com/johnsoncodehk/volar/issues/1985 — committed to jiangxd2016/eurus-ui by jiangxd2016 2 years ago
- Fix type error See: https://github.com/johnsoncodehk/volar/issues/1985 https://github.com/vuejs/core/pull/6855 — committed to iscc/iscc-web by strayer 2 years ago
- chore(dev-deps): Downgrade `@types/node` to 18.8.0 until Vue 3.2.41 https://github.com/johnsoncodehk/volar/issues/1985 — committed to ecomplus/cloud-commerce by leomp12 2 years ago
- 📌 Pin @types/node to fix volar error This commit fixes the bug where volar throws an error (see https://github.com/johnsoncodehk/volar/issues/1985) — committed to Michaelbr-Dev/P7-frontend by deleted user 2 years ago
- fix: pin @types/node to 18.8.0 to work around https://github.com/johnsoncodehk/volar/issues/1985 — committed to vuejs/babel-plugin-jsx by sodatea 2 years ago
- chore(web): pin @types/node version See https://github.com/johnsoncodehk/volar/issues/1985 — committed to raidorev/dnd-character-builder by raidorev 2 years ago
- chore(deps): update all non-major dependencies (#611) * chore(deps): update all non-major dependencies * chore: remove the lockfile and reinstall to update trnasitive deps The outdated `@types/... — committed to vuejs/babel-plugin-jsx by renovate[bot] 2 years ago
- Pinned @types/node to 18.8.0 (See https://github.com/johnsoncodehk/volar/issues/1985) — committed to Effect-Wei/Takina-Frontend by Effect-Wei 2 years ago
- dep: specify versions of @types/node - Lock @types/node to 18.8.0 - Issue: https://github.com/johnsoncodehk/volar/issues/1985 — committed to GefeiSHEN/frontend-exercise by GefeiSHEN 2 years ago
- chore(deps): downgrade @types/node https://github.com/johnsoncodehk/volar/issues/1985 — committed to Milesq/ministry-sheet by Milesq 2 years ago
- 🩹 fix https://github.com/johnsoncodehk/volar/issues/1985 — committed to jphacks/B_2221 by u-sho 2 years ago
- chore(deps): downgrade @types/node https://github.com/johnsoncodehk/volar/issues/1985 — committed to Milesq/ministry-sheet by Milesq 2 years ago
- 🎉 Init Vue app (#2) * 🎉 Init Vue app * 🔧 typescript-eslint の設定を強めにかけて型安全性を高める * 🎨 prettier でフォーマットする * 🩹 fix https://github.com/johnsoncodehk/volar/issues/1985 * 🧑💻 eslint/prettie... — committed to jphacks/B_2221 by u-sho 2 years ago
- chore(dev-deps): Unpin @types/node version https://github.com/johnsoncodehk/volar/issues/1985\#issuecomment-1283723657 — committed to ecomplus/cloud-commerce by leomp12 2 years ago
- chore(deps): update all non-major dependencies (#611) * chore(deps): update all non-major dependencies * chore: remove the lockfile and reinstall to update trnasitive deps The outdated `@types/... — committed to codegod2222/babel-plugin-jsx by codegod2222 2 years ago
For me it works after pinning
@types/node
to18.8.0
(+removing lockfile and reinstall deps).@ymy0622 I think you should leave this open. It’s not really a desired workaround to pin
@types/node
.why is this issue closed but not yet fixed?
Please wait for 3.2.42 and pin @types/node to 18.8.0 for now. 😃
seems vue@3.2.41 has been released and fixed this problem. I upgraded vue and @types/node to the latest, and the error no longer exists.
We can’t fix this problem in language server, but we will have a doctor message to remind user downgrade
@types/node
to 18.8.0 or update to next vue release.@types/node
fixed this problem in18.11.1
,18.11.2
and later version by https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62782, please upgrade to fix.But Volar
1.0.8
will still have doctor warns for18.11.1
,18.11.2
because we can’t hot update the version judge, please just ignore the warning or you can disable doctor (not recommend) by add"volar.doctor.statusBarItem": false
VSCode setting.Please track https://github.com/vuejs/core/pull/6855
Sadly this doesn’t seem to be the case for many. v3.2.40…v3.2.41 shows no indication of any fix for this and the actual fix (vuejs/core#6855) is yet to be merged and released.
@IagoLast make sure to put “@types/node”: “18.8.0” and not “@types/node”: “^18.8.0”. Edit: remove
node_modules
folder andlock
file before install again.@ymy0622 are you sure this is a real solution and not a workaround before fix ?
@warmthsea remove “^” from the version number so it installs that specific version.
18.8.0 didn’t work for me but 18.7.14 did.
Also works for me.
Wow, it works. Thank you very much.
@johnsoncodehk Shouldn’t Volar have a new version disabling the doctor warning now?
it works.
This issue persists as of
@types/node
18.8.5.@warmthsea Thanks for that. By removing
"^"
fixed the issue.remove “^” from the version number so it installs that specific version. @Suv4o
我遇到了同样的问题,解决方案是切换 VSCode 的 TS 使用工作区版本。 操作方法为 Ctrl + Shift + P,输入 selectTypeScriptVersion,然后选择 Use Workspace Version。
Same thing but when using
vue-tsc
from the console