scramjetorg / scramjet

Public tracker for Scramjet Cloud Platform, a platform that bring data from many environments together.
https://www.scramjet.org
MIT License
253 stars 20 forks source link

Getting error Class 'PromiseTransform' incorrectly implements class 'Readable' and 'Writable' #132

Closed shahabali1993 closed 1 year ago

shahabali1993 commented 1 year ago

I tried to install the latest scramjet version and getting this error on compilation.

Node-Version: 18.17.1 / Scramjet-Version: 4.36.9

$ yarn compile yarn run v1.22.19 $ tsc node_modules/scramjet/.d.ts/index.d.ts:10:15 - error TS2720: Class 'PromiseTransform' incorrectly implements class 'Readable'. Did you mean to extend 'Readable' and inherit its members as a subclass? Type 'PromiseTransform' is missing the following properties from type 'ReadableBase': iterator, map, filter, forEach, and 11 more.

10 declare class PromiseTransform implements Readable, Writable {



node_modules/scramjet/.d.ts/index.d.ts:10:15 - error TS2720: Class 'PromiseTransform' incorrectly implements class 'Writable'. Did you mean to extend 'Writable' and inherit its members as a subclass?
  Property 'compose' is missing in type 'PromiseTransform' but required in type 'WritableBase'.

10 declare class PromiseTransform implements Readable, Writable {
shahabali1993 commented 1 year ago

@MichalCz , @luccam-scr , @stokowski , @S4adam , can you please look into this issue?

MichalCz commented 1 year ago

Will check. Typescript definitions of node/stream used to be pretty bad, so if you could try to downgrade @types/node to something older (16) and rebuild then I'd know where we stand.

A small issue I'm having is the very outdated way the definitions are done - so there are two options: if method signatures need changing it will be problematic, if only missing props are added, this should be easy.

I'm also seeing a small issue with the tests, but that's a false positive.

Anyway @shahabali1993, please confirm if downgrading @types/node to 16.x allows you to build Scramjet. If we're lucky that won't make your own build fail - if that's the case let me know, I'll try to set up a small test repo.

shahabali1993 commented 1 year ago

@MichalCz thank you for the quick response, downgrading @types/node to 16.x worked with scramjet but now getting another issue with 'AbortSignal' related @types/node in file globals.d.ts.

Here's the link if you would like to follow: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/66617

Scramjet and @types/node will have to be upgraded to latest in the future though.

MichalCz commented 1 year ago

Ok. But that's a good lead - it is how I thought.

I'll follow up this week. If you can try to somehow mute this error in typescript config then please try to do so as a workaround. We'll fix this, but I can't give you dependable timelines yet (worst case scenario is end of the month).

M.

shahabali1993 commented 1 year ago

Thanks @MichalCz , please do inform here when it is fixed.

MichalCz commented 1 year ago

Hey @shahabali1993 - I have the solution, but I still need to make this work with the build script. I'll inform you on the progress.

MichalCz commented 1 year ago

@shahabali1993 please check with 4.37.0.

shahabali1993 commented 1 year ago

@MichalCz I am unable to find 4.37.0, can you please specify where I can find it? I tried updating the version in my package.json but it didn't work.

MichalCz commented 1 year ago

My bad, the package was published to the internal repo. Thanks for the heads up.

I'll release today

MichalCz commented 1 year ago

It's published now. :)

shahabali1993 commented 1 year ago

@MichalCz thank you for the quick fix.

Verified 4.37.0. All errors have been resolved, scram-jet 4.37.0 is now working with the latest version of types/node 20.6.0.

MichalCz commented 1 year ago

Fantastic! Another win for fixing at night, and another near-miss for deploying then. :D