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

Infer more precise types for bind:selected and let:option #78

Closed
janosh opened this issue Apr 22, 2022 · 4 comments · Fixed by #189
Closed

Infer more precise types for bind:selected and let:option #78

janosh opened this issue Apr 22, 2022 · 4 comments · Fixed by #189
Labels
dx Developer experience enhancement New feature or request help wanted Extra attention is needed types TypeScript

Comments

@janosh
Copy link
Owner

janosh commented Apr 22, 2022

Figure out if generics (or anything) can be used to infer the type of bind:selected and let:option in slot components correctly from type of options prop. See sveltejs/language-tools#442 (comment) for related question.

@janosh janosh added enhancement New feature or request help wanted Extra attention is needed dx Developer experience types TypeScript labels Apr 22, 2022
@janosh
Copy link
Owner Author

janosh commented Apr 22, 2022

Goal is to fix type errors like this:

Screen Shot 2022-04-22 at 12 15 02

@Michael-Reich
Copy link

Yes, this would help a lot!

@joelmukuthu
Copy link
Contributor

@janosh I'm up for helping with this, just checking to see if perhaps you're already working on it. Let me know if you'd like a PR for this :)

@janosh
Copy link
Owner Author

janosh commented Dec 17, 2022

@joelmukuthu Yes, a PR that fixes this would be amazing. 👍

I have no working branch for this yet so feel free to start fresh from main.

joelmukuthu added a commit to joelmukuthu/svelte-multiselect that referenced this issue Dec 29, 2022
janosh added a commit that referenced this issue Dec 29, 2022
* add type inference for `options` prop

Closes #78.

* update docs on TypeScript type inference

* adopt better naming for inferred-option type

* use new type GenericOption in get_label()

* update readme typescript section

Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx Developer experience enhancement New feature or request help wanted Extra attention is needed types TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants