resium icon indicating copy to clipboard operation
resium copied to clipboard

Incorrect typings with both new Cesium (>=1.117.0) and new React (>=18.3.1) + typescript (>=5.5)

Open MrShtrahman opened this issue 4 months ago • 0 comments

Hi,

I'd like to address two new (independent) issues regarding wrong typings with new Cesium and new React:

  1. Resium currently uses [email protected]. From [email protected] onwards, new attributes were added to classes on almost every release. This caused some of the tests in resium to fail, becuase the type checking wasn't precise.

For exmaple, take Billboard.ts:

1 2

In version 1.120 of cesium, Billboard.splitDirection was added, which caused mismatches between the type and the cesiumProps array in Billboard.ts:

3

After the addition (of course, checking that it's not a readonly attribute), the test passed.

There are in total 11 such cases.

  1. The upgrade of @types/react from version 18.2 to 18.3 causes breaks in the definition of forwardRef, as mentioned in this PR in react itself (They mention that it itself is being caused by typescript 5.5+).

This causes usages of forwardRef in resium to fail typescript checks, and a tiny fix would just be to change the type inside of it from Props to PropsWithoutRef<Props>>

@keiya01 I'd like to add two PRs for each issue 🙂

MrShtrahman avatar Oct 11 '24 19:10 MrShtrahman