terriajs icon indicating copy to clipboard operation
terriajs copied to clipboard

Provide ambient types or TSify some js[x] files.

Open na9da opened this issue 2 months ago • 0 comments

What this PR does

Currently, running tsc from an external library like a plugin fails with many ... element implicitly has type "any" errors. This is because tsc will not type check js/jsx modules from external libraries in node_modules. These errors can be suppressed by turning off noImplicitAny option, however this is pretty unsafe.

This PR tries not to change any functionality, instead we typify just enough files so that tsc will succeed without having to add any extra configuration. We make the following specific modifications:

  • If it is trivial, we convert .js[x] files to .ts[x] and make necessary changes so that it type checks
  • For non-trivial .js[x] files, we create an ambient .d.ts file with type signatures for all the exports
  • Upgrades markdown-it and linkify-it so that we can import their ESM versions and typings.

Test me

Please just do a random test adding different catalog items, via catalog explorer, web url and drag-n-drop, open feature info panel, charts etc.

Checklist

  • [ ] ~There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)~ Fixed broken specs.
  • [ ] I've updated relevant documentation in doc/.
  • [x] I've updated CHANGES.md with what I changed.
  • [x] I've provided instructions in the PR description on how to test this PR.

na9da avatar Apr 26 '24 00:04 na9da