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

--emitDeclarationOnly with type-based declaration is not working when using an interface #1127

Closed
Exotelis opened this issue Mar 30, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@Exotelis
Copy link

Hey,

I tried to export my type declarations with --emitDeclarationOnly and was confused that nothing happened. After quite some while I figured out, that the interface is causing the problem.

<script setup lang="ts">
import type { Variant } from '@/types/Variant';

interface Props {
  variant: Variant;
}
const props = defineProps<Props>();
</script>

However, when using the object directly as generic it works as expected :)

At least, the syntax is valid according to https://vuejs.org/guide/typescript/composition-api.html#typing-component-props

Cheers

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Apr 10, 2022
@johnsoncodehk
Copy link
Member

Thanks for the report! Here should have error report but it's missing, you need to move the Props interface to <script> tag.

<script lang="ts">
import type { Variant } from '@/types/Variant';

interface Props {
  variant: Variant;
}
</script>

<script setup lang="ts">
const props = defineProps<Props>();
</script>

@Exotelis
Copy link
Author

Thank you :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants