Skip to content

Improve HTMLImageElement.loading #48658

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

Closed
quinnlangille opened this issue Apr 12, 2022 · 3 comments
Closed

Improve HTMLImageElement.loading #48658

quinnlangille opened this issue Apr 12, 2022 · 3 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Milestone

Comments

@quinnlangille
Copy link

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

@quinnlangille
Copy link
Author

If everyone is in favour of making this change, I can open a PR anytime

@MartinJohns
Copy link
Contributor

MartinJohns commented Apr 12, 2022

microsoft/TypeScript-DOM-lib-generator#747

From the issue template for lib change requests:

The DOM lib is maintained elsewhere and you can skip a step by filing issues/PRs for the DOM at that repo.
See https://github.com/microsoft/TypeScript-DOM-lib-generator

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Apr 12, 2022
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 12, 2022
@jakebailey
Copy link
Member

This was fixed in #47445.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

4 participants