Skip to content

Error parse script on defineProps #131

@jfrank14

Description

@jfrank14

I'm trying to run the SFC loader on the out of the box application generated by vue. This app has an App.vue that references a component HelloWorld.vue that does this:

<script setup lang="ts">
defineProps<{
  msg: string
}>()
</script>

When I do this, I get the following error in the browser:

error parse script /vue/src/components/HelloWorld.vue
  4 |   props: {
  5 |     msg: { type: String, required: true }
> 6 |   } as unknown as undefined,
    |     ^ Unexpected token, expected "," (6:4)
  7 |   setup(__props: {
  8 |   msg: string
  9 | }, { expose }) {

Does the parser not know how to handle the new defineProps syntax?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingunconfirmedUnconfirmed issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions