Closed manzt closed 2 years ago
cc: @keller-mark
From the typescript perspective, there is a more “correct” way of communicating this behavior, which I will add to this PR https://github.com/DefinitelyTyped/DefinitelyTyped/blob/fb66211010980641f01bcfe8ffbc0cc3d71989ca/types/ndarray/index.d.ts#L43
Ok, I've changed the TYPED_ARRAY_MAPPING
to inspect globalThis
on import only, and also removed the global declaration from zarr
. This way it is up to the end user to add the global declaration and be explicit about the type.
with globalThis.Float16Array
defined in user code (TypedArray
union includes Float16Array
).
without globalThis.Float16Array
defined in user code (TypedArray
union does not include Float16Array
).
ref: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/56163#discussion_r732279580
I'll merge and add some additional docs.
Fixes #127
This PR implements optional support for
float16
datatypes by inspectingglobalThis.Float16Array
. Rather than adding https://github.com/petamoriken/float16 as a dependency, users must opt into this behavior by addingFloat16Array
as a global in their environment.