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
Weird behavior with Generics + SvelteHTMLElement #2271
Comments
The generic function isn't the same. The component type is more complex than a simple function. Because of the extra complexity, the completion probably got wrong. Anyway, this will have to be fixed in TypeScript. There is probably not much we can do. Edit: I can also see |
Oh yeah i tought that could've been the case but didn't think of ways to test it...thanks for the playground |
Describe the bug
I was creating an "isomorphic component" (basically where you pass
as
and it render the correct html element) and i started experimenting with the typings to get autocompletion. I come up with this which works finethe typecheck per se works fine but what is a bit iffy it's the autocompletion. You get autocomplete for every prop even the one that are not associated with the type T (for example you get autocomplete for
type
if you usespam
foras
). I tried the same generic function in the typescript playground and it works correctly.Screen.Recording.2024-01-25.at.20.01.05.mov
Screen.Recording.2024-01-25.at.20.03.01.mov
Reproduction
Expected behaviour
You should only get autocompletion for the correct element
System Info
Which package is the issue about?
No response
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: