Skip to content

[BUG] Props object is empty, values in attrs instead #614

Open
@lmiller1990

Description

@lmiller1990

Describe the bug

I am using Vue with TSX. The props object does not contain the property I expect. It is available on attrs.foo, but this is not what I was expecting (maybe I misunderstood how the TSX plugin works)?

Possible dup of #607. Posting in English for more 👀 .

I can debug this if it's confirmed to be an actual bug?

import { defineComponent } from "vue";

const Bar = defineComponent<{ foo: string }>({
  setup(props) {
    return () => <h1>{props.foo}</h1>
  }
})

export const App = defineComponent({
  setup() {
    return () => <Bar foo='foo' />
  }
})

Reproduction

https://github.com/lmiller1990/vue-tsx-props-bug

Steps to reproduce

yarn
yarn dev

Code is in src/App.tsx.

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) x64 Apple M1 Pro
    Memory: 147.48 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  Browsers:
    Chrome: 106.0.5249.119
    Firefox: 100.0
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-vue: ^3.1.0 => 3.1.2 
    @vitejs/plugin-vue-jsx: ^2.0.1 => 2.0.1 
    vite: ^3.1.0 => 3.1.8 


### Used Package Manager

yarn

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