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

Support generic type parameters #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ethanchristensen01
Copy link

This update enables type checking scoped slots, and by extension, lets developers get type completions while writing the #item slot.

There is a "breaking change" to consider here: to access the type of the component, we can no longer use InstanceType<typeof sortable>, because it doesn't work with generic components. We have to replace InstanceType with ComponentExposed as described in this issue: Cannot use InstanceType<typeof Comp>> on generic components.

This requires adding 'vue-component-type-helpers' (from the official Vue Language Tools repository) as a dev dependency.

Copy link

vercel bot commented Sep 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sortablejs-vue3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 11:55pm

@ethanchristensen01
Copy link
Author

Here's a screenshot of the type-hint you get in vs-code while hovering over the item slot of HelloWorld.vue. It automatically infers this from the type of the items parameter.
image

@ethanchristensen01
Copy link
Author

@MaxLeiter I don't know if you saw this. It should be pretty quick to review if you're interested in taking a look.

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.

1 participant