openlayers icon indicating copy to clipboard operation
openlayers copied to clipboard

Better types in examples

Open MoonE opened this issue 11 months ago • 5 comments

This adds a lot of types, but also includes some code improvements.

  • wms-custom-proj did some unnecessary steps when converting between projections
  • The Edit button to edit on codesandbox now uses the 'dev' tag as the version instead of an non-existent version like v10.4.1-dev
  • Some examples updated their style on each pointermove event instead of only when the selection changes

MoonE avatar Feb 09 '25 23:02 MoonE

📦 Preview the website for this branch here: https://deploy-preview-16628--ol-site.netlify.app/.

github-actions[bot] avatar Feb 09 '25 23:02 github-actions[bot]

I appreciate the work you’ve done here, but fear it may just be undone over time if there is nothing enforcing stricter type checking. I know that I have removed type casts over time when I come across one that isn’t required (or isn’t being enforced).

Is there a setting that you’re working with that complains about the unknown types? Can we incrementally add checks to ensure the work you’ve done isn’t undone?

tschaub avatar Feb 19 '25 14:02 tschaub

This PR here adds types to all cases that were obvious to me. For the reset I'd appreciate some help. But in case there is no solution we can add // ts-ignore.

Then "examples/**/*.js", can be permanently added to tsconfig.json.

MoonE avatar Feb 19 '25 20:02 MoonE

@tschaub I added "examples/**/*.js", " to the tsconfig.json, and explicitly excluded those that do not yet pass.

MoonE avatar Feb 26 '25 20:02 MoonE

Hi Great work, congratulations, but my knowledge doesn't allow me to understand the benefits of variable typing in examples. So, without understanding the benefits of this typing, I only see it as complicating the code and moving away from simple, basic JavaScript, which should remain so for our examples...???

jipexu avatar Jun 17 '25 16:06 jipexu