Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic component shows error for props with kebab-case #3765

Closed
dvdmlln opened this issue Nov 30, 2023 · 9 comments · Fixed by #3774
Closed

Dynamic component shows error for props with kebab-case #3765

dvdmlln opened this issue Nov 30, 2023 · 9 comments · Fixed by #3774
Labels
bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first

Comments

@dvdmlln
Copy link

dvdmlln commented Nov 30, 2023

Hi,

since 1.8.24 Volar shows an error when using a dynamic component with an imported component object and a kebab-case required prop.

Example:
FooBar component has a required prop fooBar. The following leads to an error Property 'fooBar' is missing in type.

<template>
  <component :is="FooBar" :foo-bar="text"></component>
</template>

<script>
import { FooBar } from '#components'
</script>

Best regards
David

@rchl
Copy link
Collaborator

rchl commented Nov 30, 2023

#3750 is likely related.

@rchl
Copy link
Collaborator

rchl commented Nov 30, 2023

Actually my testing shows that it works the same in both 1.8.22 and 1.8.24 so maybe I'm missing something. Can you provide a repo that reproduces this issue? It looks like the type of FooBar or the project configuration might be relevant.

@rchl
Copy link
Collaborator

rchl commented Nov 30, 2023

FYI: I've been testing with this code since your example doesn't produce any errors in the project I've been using:

<template>
	<component :is="Foo" :stoke-width="'abc'" />
</template>

<script setup lang="ts">
import { defineComponent } from 'vue';

const Foo = defineComponent({
	props: {
		strokeWidth: { type: String, required: true },
	}
});
</script>

This produces and error in both Volar versions.

Screenshot 2023-11-30 at 22 31 23

@dvdmlln
Copy link
Author

dvdmlln commented Dec 4, 2023

I've set up an reproduction repo here: https://github.com/dvdmlln/vue-tsc-dynamic-component-props
Running npm run type-check produces an error. Setting vue-tsc to fixed version 1.8.22 does not produce an error.

@throrin19
Copy link

Same problem here, it works fine in 1.8.22 and no more in 1.8.24

@rchl rchl added good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first bug Something isn't working labels Dec 4, 2023
@WangJincheng4869
Copy link

May I ask, when can this fatal bug be fixed?

@rchl
Copy link
Collaborator

rchl commented Dec 4, 2023

You can but you won't get a specific answer.
In the mean time you can pin Vue extension to 1.8.22 in VSCode (the dropdown next to "Uninstall" button)

@gangsthub
Copy link

#3750 is likely related.

Also #3255

@so1ve
Copy link
Member

so1ve commented Dec 4, 2023

#3774

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants