CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
13k stars 3.5k forks source link

DX: Fix `defined` and `Check` types for CesiumJS devs #12312

Open jjspace opened 6 days ago

jjspace commented 6 days ago

Description

Before After
2024-11-15_16-11 2024-11-15_16-11_2
Before After
2024-11-15_16-14 2024-11-15_16-19

Issue number and link

No issue, just a small DX issue I've grown too tired of seeing

Testing plan

Author checklist

github-actions[bot] commented 6 days ago

Thank you for the pull request, @jjspace!

:white_check_mark: We can confirm we have a CLA on file for you.

jjspace commented 2 days ago

@javagl Would you mind taking a look at this? I think you've been looking into our type system and typescript adjacent stuff recently so you might be a good person to provide input.

jjspace commented 1 hour ago

After enabling the "Check JS" functionality in VS Code, it did complain about many things. But it did not generate the "...is possibly undefined" messages for me.

@javagl I sometimes find I have to run the Restart TS Server or Reload Window commands to refresh typescript. They seem to cache some things internally or something that makes it get out of sync, especially in JS environments that aren't actually TS 2024-11-22_11-59_1 2024-11-22_11-59

This is NOT in the scope of this PR, but I cannot look at the gulpfile.js without pointing out that this is one of my pet peeves

I fully agree with this sentiment, I'd love if the logic was centralized because I always forget to change both any time I touch this. Definitely outside the scope of this PR though. I'm happy to review a PR for cleaning up the gulpfile but as you say, every time I touch this file I'm worried about breaking something