Skip to content

Cannot find name '<prop_from_script_setup>'.ts(2304) #319

@robyedlin

Description

@robyedlin

Hi there!

In recent versions of volar, I'm getting an error `Cannot find name '<variable_from_script_setup>'.ts(2304) on any prop variable used in templates.

Bug seems to be introduced in 0.26.1

Code:

<template lang="pug">
li(class="py-1")
  router-link(:to="to") // Cannot find name 'to'.ts(2304)
    span(class="Icon")
      component(:is="iconComponents[icon]") // Cannot find name 'icon'.ts(2304)
    span {{ text }} // Cannot find name 'text'.ts(2304)
</template>

<script setup>
import { defineProps } from 'vue'
import IconUsers from '/@/components/icons/Users.vue'

const iconComponents = {
  'users': IconUsers
}

defineProps({
  to: {
    type: String,
    default: '/'
  },
  icon: {
    type: String,
    default: ''
  },
  text: {
    type: String,
    default: ''
  }
})
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions