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

Typescript types are massively broken #70

Closed intellix closed 4 years ago

intellix commented 4 years ago

Trying to use scramjet in TypeScript and getting a bucket of errors such as:

Just looking at them I'm not sure if they were ever meant to work or in what version of TypeScript they did but there's clearly references to types that aren't ever provided like ScramjetOptions:

https://github.com/signicode/scramjet/blob/2fcaefcb6c29064457f789f8303a9ec24cc7ec5a/.d.ts/scramjet.d.ts#L40-L45

Screenshots

Screenshot 2020-01-23 at 21 14 40

System:

MichalCz commented 4 years ago

Hi @intellix, thanks for reporting this.

I'll look into how much work it is. The TS.d file is generated from jsdoc, I made a lot of modification in it to make it compile but without an automated test I can't really know if the docs are bang on perfect (and therefore the TS.d).

If you have an idea for an automated test and could create a repo with it, then I could add this to my CI settings and make sure everything is up to date. Eventually I'd like to rewrite all tests to typescript and most of scramjet as well.

MichalCz commented 4 years ago

@intellix would you be interested in helping out and setting a test repo for this?

What I need is a repo and a set of commands that in the end would result in an exit status that I could base my test on.

MichalCz commented 4 years ago

Ok, so I've done some research around this and I'm going to rebuild the whole generation of documentation based solely on d.ts files. I managed to get very good code hinting with generic code.

I'll update this issue with the branch, where I'm going to work on this.

I found a way to do interface checks on js files which was the biggest dillema.

MichalCz commented 4 years ago

ScramjetOptions is now fixed. Better typings will be here in 4.29.

deman4ik commented 4 years ago

Typescript typings still broken in 4.29 Screenshot 2020-05-11 at 19 15 32

MichalCz commented 4 years ago

@deman4ik yes, I'm still trying to make the compiler not to get into a loop and at the same time be able to fully support internal function typings (hint for instance map -> map operation).

This works in VSCode, but compiling against this causes call stack exceeded errors. :/

MichalCz commented 4 years ago

@intellix @deman4ik can you guys check scramjet@4.30?

deman4ik commented 4 years ago

@MichalCz seems good. Thank you for your work!

MichalCz commented 4 years ago

@deman4ik @intellix guys, another major rewrite of the d.ts files - can you check how this works now.

I removed completely the declare module thing and replaced it by top level declarations - these seem to work well for me and I see that the node.js stream inheritance now works well, although it would be good to know if that worked in an actual typescript project.

deman4ik commented 4 years ago

@MichalCz Updated to 4.33.0. TS build is fine in my project without any changes. 👍

MichalCz commented 4 years ago

Great. :)