You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SvelteHTMLElements type used to be set of typed HTML elements, so it was possible to get the union of literals by simply getting all its keys using keyof SvelteHTMLElements.
Now that it can be any key, autocompletion no longer works because 'a' | ''div' | string will always be of type string.
Autocompletion is possible thanks to the & {} trick in TS, so in this case add it to name key. Preserves that the key can be any string, and adds autocompletion.
# packages/svelte/elements.d.ts- [name: string]: { [name: string]: any };+ [name: string & {}]: { [name: string]: any };
If it makes sense to you, I have a branch ready with changes.
Importance
would make my life easier
The text was updated successfully, but these errors were encountered:
Problem
SvelteHTMLElements
type used to be set of typed HTML elements, so it was possible to get the union of literals by simply getting all its keys usingkeyof SvelteHTMLElements
.Now that it can be any key, autocompletion no longer works because
'a' | ''div' | string
will always be of typestring
.Use case
Auto completion for
svelte:element
tag.Describe the proposed solution
Autocompletion is possible thanks to the
& {}
trick in TS, so in this case add it toname
key. Preserves that the key can be any string, and adds autocompletion.If it makes sense to you, I have a branch ready with changes.
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: