How to fix TypeScript warnings and errors when using Client Scripts? #189
Unanswered
icehaunter
asked this question in
Q&A
Replies: 1 comment
-
Hi Ilia! As in the examples of the Client Scripts section, you should always use The <script client:load lang="ts">
export function onLoad () {
console.log('Now visible')
}
</script> The In this case, it could be Volar being confused because the client script doesn't have exports, which you can fix. In other cases, check that you are including the types for /// <reference types="iles" /> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description 📖
Usage of
<script client:load lang="ts">
in a Vue component displays an error in VSCode under Volar if there is no other script block. When adding such a snippet, it immediately does two things: loses all highlights of components and stuff like$frontmatter
, and complains about lack ofexport
under--isolatedModules
. Removing--isolatedModules
helps, however Volar will still complain about references to$frontmatter
. Adding<script setup lang="ts"></script>
solves the issue.I'm not sure this is fixable, so I think this should be referenced in the docs, since the "minimal example" provided there won't work out of the box.
Reproduction 🐞
pnpm create iles@next
./src/components/Welcome.vue
Dependencies Info
Run
npx iles info
andpnpm list
(ornpm list
) and provide the output:Screenshots 📷
If used without

lang="ts"
:If used with


lang="ts"
:and
Beta Was this translation helpful? Give feedback.
All reactions