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

refactor: implement prop types #203

Merged
merged 1 commit into from
Jun 23, 2024
Merged

refactor: implement prop types #203

merged 1 commit into from
Jun 23, 2024

Conversation

MichaHuhn
Copy link

Implement prop types by using the type-based declaration.

Convert the runtime declaration:

defineProps({
  icon: {
    type: Object as () => CustomIcon
  }
})

to the type-based declaration:

defineProps<{
  icon: CustomIcon
}>()

The type-based declaration provides type-safety and autocompletion when using props.
The prop types work exactly like the emit types (#199).

Copy link
Owner

@sebinside sebinside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always wondered whether there is a notation like this. Perfect, thank you!

@sebinside sebinside merged commit 8c4282d into sebinside:preset-support Jun 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants