-
Notifications
You must be signed in to change notification settings - Fork 349
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
fix(cli): missing props/emits when doesn't enable typescript #105
Conversation
Thanks for the hard work @Dunqing ! Could you add a simple test case for this transformation? 😁 |
Sure, I added |
Tested your branch, Button.vue <script setup>
import { buttonVariants } from '.'
import { cn } from '@/lib/utils'
withDefaults( // <=== this API is typescript related
defineProps({
variant: { type: null, required: false },
size: { type: null, required: false },
as: { type: String, required: false, default: 'button' },
}),
{
as: 'button',
},
)
</script>
<template>
<component
:is="as"
:class="cn(buttonVariants({ variant, size }), $attrs.class ?? '')"
>
<slot />
</component>
</template> Also tested with
When
|
Thank you for testing this PR! Yes, I forgot the case with |
@sadeghbarati Can you take a look at it again? Thank you |
|
Oh, This case seems hard to fix. Even if I pass |
Now it's supported! Do you @sadeghbarati have time to test again? I have tested it, Looks good! |
Sure thanks for your efforts ❤️ |
All good ❤️ but this 👇 which is happening in some component - const defineProps
+ const props = defineProps |
Thanks, I noticed that the test cases had this problem as well |
Fixed |
Absolute amazing work @Dunqing ! Thanks for taking on this difficult challenge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! ❤️
close: #62
Since the author left it unaddressed for a long time, and in case Javascipt users long time to use, I publish a detypes package to temporarily fix the problem.