TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

[Web API type definition issue] ImageData constructor missing type `Float16Array`

Open cmahnke opened this issue 4 months ago • 4 comments

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

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

Have Tried The Latest Releases

  • [x] This issue applies to the latest release of TypeScript.
  • [x] 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

cmahnke avatar Aug 06 '25 07:08 cmahnke

Hello @cmahnke Once BCD adds it, it will be added

Bashamega avatar Aug 06 '25 08:08 Bashamega

@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

cmahnke avatar Aug 19 '25 11:08 cmahnke

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

Bashamega avatar Aug 19 '25 12:08 Bashamega

Just an update: PR https://github.com/mdn/browser-compat-data/pull/27661 which closed https://github.com/mdn/browser-compat-data/issues/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 ?

cmahnke avatar Aug 26 '25 16:08 cmahnke