terriajs
terriajs copied to clipboard
Provide ambient types or TSify some js[x] files.
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
andlinkify-it
so that we canimport
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.