geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
878 stars 183 forks source link

Auto-generate types #253

Closed ahocevar closed 2 years ago

ahocevar commented 3 years ago

This pull request adds the tooling to generate and publish types as *.d.ts files. It also makes minor adjustments to geotiff and geotiffimage to use the correct types for their respective APIs.

To make JSDoc work with type imports, I pulled in jsdoc-plugin-typescript.

When the library is restructured as suggested in #242, the "checkJs": true setting can be added to tsconfig.json, and the whole library can be properly type annotated. Right now this would not really work because the Parcel generated single script module does not match the module structure that tsc generates. But even with just this pull request, the generated types are already useful for application developers.

Supersedes #230. Fixes #225.

ahocevar commented 3 years ago

The failing tests are unrelated to this pull request - they currently also fail in the default branch.

ahocevar commented 2 years ago

Rebased and updated so types are also generated for the dist-module/ directory, where they will be most useful because they match the file structure.