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
845 stars 175 forks source link

Typescript compilation error in BaseClient #400

Closed bunnyhugdev closed 6 months ago

bunnyhugdev commented 9 months ago

Starting in version 2.1.0 of geotiff, there is a Typescript compilation error when importing the geotiff module.

Error: node_modules/geotiff/dist-node/source/client/base.d.ts:28:15 - error TS2339: Property 'headers' does not exist on type '{}'.

28     request({ headers, credentials, signal }?: object): Promise<void>;
                 ~~~~~~~

Error: node_modules/geotiff/dist-node/source/client/base.d.ts:28:24 - error TS2339: Property 'credentials' does not exist on type '{}'.

28     request({ headers, credentials, signal }?: object): Promise<void>;
                          ~~~~~~~~~~~

Error: node_modules/geotiff/dist-node/source/client/base.d.ts:28:37 - error TS2339: Property 'signal' does not exist on type '{}'.

28     request({ headers, credentials, signal }?: object): Promise<void>;

I've verified this is not an issue in 2.0.7. I've attached a small angular app that demonstrates the issue (since that's my current environment). Unzip the project and run npm install and ng serve (you'll have to install angular if you do not have it already - npm install -g @angular/cli.

geotiff.zip

Thanks!

dobripet commented 9 months ago

Same issue here, I had to workaround it by using of overrides in package.json back to 2.0.7.

LastMinuteClub commented 8 months ago

Same issue here too. As this is a dependency for OpenLayers, it breaks angular builds using OL.

pcace commented 8 months ago

try this in line 28 request({ headers, credentials, signal }?: { headers?: HeadersInit, credentials?: RequestCredentials, signal?: AbortSignal }): Promise<void>;

immanewel commented 8 months ago

Same issue here, I had to workaround it by using of overrides in package.json back to 2.0.7.

for me it does not work, I use angular 15.2.0

amuelli commented 8 months ago

is this the same as #406 and therefore already fixed?

filipon21 commented 8 months ago

is this the same as #406 and therefore already fixed?

I still have this issue even after that fix

shaman-apprentice commented 8 months ago

As far as I can see, it was merged, but there was no release afterwards. I would appreciate a quick patch release, as this is the only blogger for us to upgrade from Angular 16 to 17.

(Kind of weird, that Angular 16 to 17 upgrade is blocked for us by Angular's change from TypeScript @~5.1.x to @~5.2.x, which breaks another dependency. In my humble opinion Angular shouldn't enforce a TypeScript version and a minor update of TypeScript shouldn't break anything; but it is what it is... 😅 - thanks a lot for this awesome open source library!)

filipon21 commented 8 months ago

Oh okey, so all we have to do now is wait :D

softmasters commented 8 months ago

Hello, you may temporarily use a workaround, setting "skipLibCheck": true in the tsconfig.json of your angular workspace. This will force the compiler to skip the type checking for all type definitions. As an alternative you may also edit the file node_modules/geotiff/dist-node/source/client/base.d.ts, changing the line: request({ headers, credentials, signal }?: object): Promise<void>; to: request({ headers, credentials, signal }?: any): Promise<void>; Be aware that using the second option your changes will be lost if you recreate the node_modules directory.

javier-lopez-1s commented 7 months ago

Same issue here. I'm using Angular 15 and OpenLayers 7.5.2. "skipLibCheck": true works, but as @softmasters correctly says it is a temporary workaround. Is there any release planned soon?

shaman-apprentice commented 7 months ago

Is there anything we can help with, to get the correct typing out quickly as an official release? :)

constantinius commented 7 months ago

I released v2.1.1

Please let me know if this fixes the issue

shaman-apprentice commented 7 months ago

Thanks a lot! It works for us 👍

javier-lopez-1s commented 6 months ago

The new release works for me too. "skipLibCheck": true is no longer needed. Thanks!