Auto imported functions show type error in <template>
Hi there!
I've stumbled upon a weird issue where some of the auto imported functions are showing type errors in the
<template>
tag.
For example, the function withModifiers()
from vue works correctly in the <script>
tag, however, when I use it in the <template>
, vue-tsc says that Property 'withModifiers' does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>>...
I am using the i18n module and when I remove it from nuxt config, the issue goes away.
I was able to reduce my project to the following:
package.json
nuxt.config.ts
app.vue
Could someone please help me debug it further? I'd like to create an issue but first I'd like to figure out whether this is a nuxt issue or whether to blame i18n for it.28 Replies
I have the same problem
what Nuxt version are you using?
I am having absolutely same issue, I just made almost the same post. I am thinking that it can be just issue with an IDE or extension, what IDE do you use?
I use WebStorm
However, I don't think it's IDE related as
vue-tsc
shows the error in the console as well & the build fails too.
@danielroe sorry for the ping but as multiple people posted about this, I wanted to ask whether you've encountered this already or not
is there something I can help with? I haven't seen an issue about it in nuxt/nuxt, should I create one?Can you reproduce in a pure TS file with just running tsc?
what do you mean by pure ts file? we've only noticed it to be a problem in the <template> tag of a single file component
latest version
Yesterday there was no problem, today it started giving errors
Is it a problem in a .ts file with defineComponent?
I found solution, not ideal but when you downgrade version of vue from latest to 3.4.35 its fine. So probably some issue with newest vue version
Might be an issue if you have multiple versions of vue installed?
until 22 min ago, 3.4.35 was the latest version
I'm getting this same error, accidentally opened a duplicate
I was wrong, my IDE probably didn't load the errors, now I see them. Older vue version doesn't fix it
Okey in my case it has to do something with @nuxtjs/i18n module... when I remove it from modules array in nuxt config, error goes away
that's what helped me too, but only in a small reproduction.. didn't help in my main project
Here is the minimum reproduction: https://stackblitz.com/edit/github-4ay9hh-wvhsu1?file=app.vue
It doesn't show error there but it shows this in VSCode when you clone it