Skip to content

Improve HTMLImageElement.loading #48658

Closed
@quinnlangille

Description

@quinnlangille

lib Update Request

Configuration Check

My compilation target is ES2015 and my lib is the default.

Missing / Incorrect Definition

HTMLImageElement.loading is currently a string, but the only valid values for it are eager and lazy

Sample Code

While the string works, it allows for invalid values. ex:

<img loading="random value" />

is valid, as well as:

interface ImageWrapper {
  image: HTMLImageElement
}

const imageWrapper: ImageWrapper = { image: new HTMLImageElement() }
imageWrapper.image.loading = 'random value'

I would expect both of these cases to throw a warning at least on invalid/not useful value

Documentation Link

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions