Skip to content

fix: update TypeScript types#1805

Merged
akki-jat merged 3 commits intoshentao:masterfrom
G-Rath:patch-1
Feb 11, 2025
Merged

fix: update TypeScript types#1805
akki-jat merged 3 commits intoshentao:masterfrom
G-Rath:patch-1

Conversation

@G-Rath
Copy link
Copy Markdown
Contributor

@G-Rath G-Rath commented Nov 21, 2024

This overhauls the types so that they actually work for Vue 3, being primarily based on the prop types for each component/mixin and tested locally using a project of mine.

They're by no means perfect but they'll mean type checking actually works properly and they can be refined over time - unfortunately I'm not sure if it'll be possible to strictly type everything due to the large degree of freedom around handling object-type options (i.e. trackBy and label, which in theory should be supportable with generics, except with the way Vue types work I'm not sure it'll be possible to actually properly pass generics around), but this should at least get the ball rolling.

As I've only just started exploring this library, I'm happy to be told if a prop should be of a particular type.

@mattelen
Copy link
Copy Markdown
Collaborator

@akki-jat as the TS pro, would you like to review this one?

@akki-jat
Copy link
Copy Markdown
Collaborator

@akki-jat as the TS pro, would you like to review this one?

Sure @mattelen. I will check.

@akki-jat
Copy link
Copy Markdown
Collaborator

akki-jat commented Feb 4, 2025

@G-Rath Please re-base your branch with latest master

@G-Rath
Copy link
Copy Markdown
Contributor Author

G-Rath commented Feb 4, 2025

@akki-jat there you go

@G-Rath G-Rath requested a review from akki-jat February 10, 2025 18:53
Copy link
Copy Markdown
Collaborator

@akki-jat akki-jat left a comment

Choose a reason for hiding this comment

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

Awesome work @G-Rath 👏

@akki-jat akki-jat merged commit 850c495 into shentao:master Feb 11, 2025
@G-Rath G-Rath deleted the patch-1 branch February 11, 2025 02:49
@ghrapan
Copy link
Copy Markdown
Contributor

ghrapan commented Feb 11, 2025

Great work! But I'm afraid there is an error in the types - the modelValue can also be null (a null is both accepted and returned if nothing is selected - check update:modelValue events in the code).

BTW, returning null instead of undefined is a major drawback of this otherwise great library. I have to use it with a wrapper that converts null to undefined.

@G-Rath
Copy link
Copy Markdown
Contributor Author

G-Rath commented Feb 11, 2025

@ghrapan feel free to do a pull request to refine the types further!

@ghrapan
Copy link
Copy Markdown
Contributor

ghrapan commented Feb 11, 2025

@akki-jat Please review the #1853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants