Skip to content

HtmlAttributesMap for svelte/elements #16282

@FalkZ

Description

@FalkZ

Describe the problem

Right now HTMLAttributes<HTMLButtonElement> is not the same as HTMLButtonAttributes. Which makes sense if you look at the implementation.

But it means there is no good generic way, to retrieve these specific HtmlAttributes.

It would help me if there was sth. like this:
HTMLAttributesMap["button"] to be the same as HTMLButtonAttributes.

Describe the proposed solution

Create a type like this in svelte/elements:

export interface HtmlAttributesMap {
  button: HTMLButtonAttributes;
  div: HTMLAttributes<HTMLDivElement>
   // ...
}

The same structure exists in typescript for HtmlElements called HTMLElementTagNameMap.

If you think this is sth. you want to add, I am happy to provide a PR for it.

Thanks a lot in any case :)

Importance

would make my life easier

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions