vuejs / babel-plugin-jsx

JSX for Vue 3
https://vue-jsx-explorer.netlify.app
MIT License
1.7k stars 143 forks source link

[BUG] Typescript typings #696

Open Indeedornot opened 4 months ago

Indeedornot commented 4 months ago

🐛 Bug description

I'll use this issue to report multiple issues I have found while working with the plugin

const LogInput = defineComponent( (_, { emit }: SetupContext<{ log: (msg: string) => void }>// : { emit: { log: (msg: string) => void } } - no difference in typing ) => { const input = ref('') const log = (msg: string) => emit('log', msg); return () => (

{ if (e.key !== 'Enter') return; log(input.value); input.value = ''; }} />
);

} // #Works with such declaration: // { // emits: { // log: (msg: string) => true // } // } // #Does not work with runtime and resolveTypes )

used [jsx-explorer](https://vue-jsx-explorer.netlify.app/) to check code

- 'class', 'style' and other passthrough attributes are throwing error even with 'inheritAttrs': true
```tsx
      <LogMessages
        //class is not found throwing an error
        class=""
      />

    inheritAttrs: true

📝 Steps to reproduce

Create a new tsx repository using create-vue

Reproduction Link: Reproduction

🏞 Desired result

🚑 Other information

Indeedornot commented 4 months ago

After diving deeper into this issue it appears to be a connection of problems between two repositories Language Tools And this one There would be need to add a resolver for defineComponent for types including the resolveTypes and vModel

Should this issue be moved to Language Tools repository?