johnsoncodehk / vue-tsc

vue-tsc --noEmit && vite build
https://www.npmjs.com/package/vue-tsc
MIT License
241 stars 6 forks source link

`v-slot` cannot find `v-for` variable (Vue 2) #53

Closed Shinigami92 closed 3 years ago

Shinigami92 commented 3 years ago

I'm having a line:

v-data-table(...)
  template(v-for="headerElement in headers", v-slot:[`header.${headerElement.value}`]="{ header }")

But vue-tsc failes with

src/components/MatchesTable/MatchesTable.vue:29:72 - error TS2304: Cannot find name 'headerElement'.

  template(v-for="headerElement in headers", v-slot:[`header.${headerElement.value}`]="{ header }")

So I tried it with

v-data-table(...)
  template(v-for="headerElement in headers")
    template(v-slot:[`header.${headerElement.value}`]="{ header }")

But this results in a real issue [vite] Internal server error: <template v-slot> can only appear at the root level inside the receiving component


I'm using

"vueCompilerOptions": {
  "experimentalCompatMode": 2
}

It worked somewhere in the past 🤔

Shinigami92 commented 3 years ago

Works perfect 🎉 Thanks hero 🥇