silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
161 stars 17 forks source link

Remove useless fragments #1663

Closed axelboc closed 3 weeks ago

axelboc commented 3 weeks ago

I found an old stash from a past attempt at upgrading TypeScript from 5.0 to 5.2. Turns out I missed this refactoring opportunity when I looked at it again in #1636.

I had also taken some notes of interesting changes in 5.1 and 5.2 in case this is of interest:

Typescript 5.1

TypeScript 5.2

loichuder commented 3 weeks ago

TypeScript 5.2

* [Easier Method Usage for Unions of Arrays](https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#easier-method-usage-for-unions-of-arrays) - we can finally loop through arrays of type `number[] | TypedArray` with
  `filter`, `map`, etc. but now that I'm looking through the code, I can no longer recall a specific case where we had to work around this limitation... 🤷‍♀️

IIRC, it was for the bounds computation: https://github.com/silx-kit/h5web/blob/86848a7fe2fd9e11563276c3ddc41eae764711e6/packages/shared/src/vis-utils.ts#L128

axelboc commented 3 weeks ago

IIRC, it was for the bounds computation:

Ooh nice! :fishing_pole_and_fish:

axelboc commented 3 weeks ago

Arf no luck, seems to work only with unions of plain arrays, like number[] | string[], not with unions of typed and plain arrays like in the case of the NumArray type in getBounds. :cry: