scramjetorg / scramjet

Public tracker for Scramjet Cloud Platform, a platform that bring data from many environments together.

Home Page:https://www.scramjet.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript types are massively broken

intellix opened this issue · comments

commented

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

  • Cannot find name 'ScramjetOptions'.
  • Generic type 'Promise' requires 1 type argument(s).
  • Generic type 'Iterable' requires 1 type argument(s).

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:

  • OS: [e.g. Ubuntu Server 18.04] OSX
  • Node version: [e.g. v10.6.0] 12.13.1
  • TypeScript version: 3.7.2
  • Scramjet Version: [e.g. 4.19] 4.27.0

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.

@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.

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.

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

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

@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. :/

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

@MichalCz seems good.
Thank you for your work!

@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.

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

Great. :)