Skip to content

[Web API type definition issue] ImageData constructor missing type Float16Array #2107

Open

Description

@cmahnke

Summary

Missing type in constructor

Expected vs. Actual Behavior

This is a fairly recent change, the ImageData constructor now accepts Float16Array as type for data in it's constructor, see:
https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagedataarray

There already is an issue on MDN to reflect this.

Playground Link

No response

Browser Support

  • This API is supported in at least two major browser engines (not two Chromium-based browsers).

Have Tried The Latest Releases

  • This issue applies to the latest release of TypeScript.
  • This issue applies to the latest release of @types/web.

Additional Context

Browser support:

  • Currently this is implemented in Chromium 137 and later
  • The current source of Safari also has support, I haven't checked if this is already in the latest published version

Activity

  1. Bashamega commented on Aug 6, 2025

    @Bashamega
    Contributor

    Hello cmahnke
    Once BCD adds it, it will be added

  2. cmahnke commented on Aug 19, 2025

    @cmahnke
    Author

    Adam Naji (@Bashamega) Are you sure it is working that way? I'm asking because the documentation comment already has the proposed change, see https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/main/baselines/dom.generated.d.ts#L19070

    I states that ImageData.data might be a Float16Array. It returns ImageDataArray, but the definition doesn't contain Float16Array. This is closely related since the definition of ImageDataArray is still wrong here. Interestingly @webref/idl has this since 3.61.4

    Maybe a manual change is needed to reflect the current comment?

    In any case there is a BCD issue now

  3. Bashamega commented on Aug 19, 2025

    @Bashamega
    Contributor

    If it is implemented here, then wait until typescript updates it

  4. cmahnke commented on Aug 26, 2025

    @cmahnke
    Author

    Just an update:
    PR mdn/browser-compat-data#27661 which closed mdn/browser-compat-data#27547 has been merged into min and will certainly be in the next release.

    Should I create a PR to remove https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/main/inputfiles/removedTypes.jsonc#L401-L407 ?

  5. cmahnke commented on May 11, 2026

    @cmahnke
    Author

    #2320 is somewhat related and already has been merged, even though Safari hasn't enabled it by default (as of merging). I assume having a API change shipped by default isn't actually required, having it implemented is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions