zip.js icon indicating copy to clipboard operation
zip.js copied to clipboard

Using Typescript for ZipJS

Open Synxis opened this issue 2 years ago • 2 comments

Hello,

You seem to put a lot of work into synchronizing the javascript code and its Typescript typings...

Why not simply write the whole library directly in Typescript ?

This is maybe a big change, and probably only feasible for v3, but if would eliminate the need for those external typings, and also enable a more reliable code. I also find that typed code is much easier to navigate.

What do you think ?

Synxis avatar Jul 27 '22 13:07 Synxis

Hi,

Actually, maintaining the TypeScript typings does not really induce a lot of efforts. The problem is that I did not read the manual so I make often mistakes (making it work in VSCode properly was also quite painful). In the last few weeks, this has been amplified a bit by the fact that I've evolved the code to rely on Streams as much as possible under the hood. This has had a lot of impact on the code and some impact on the interface contracts.

As it stands, I am quite happy with the situation. The typing file is supported in VSCode out of the box. I did not need to install any TypeScript related toolkit. It also allows me to check and find bugs or omissions. I'm also very happy that I don't necessarily need a build tool to code and debug.

However, I am not fundamentally against a TypeScript port for v3 for example. For now, personally, I find TypeScript code more difficult to read than JavaScript but it's probably a matter of habit. I just need to read the whole manual meanwhile ;)

gildas-lormeau avatar Jul 27 '22 16:07 gildas-lormeau

I see, I hadn't considered the build step of Typescript...

Glad you're open to Typescript for v3, and that leaves you the time to read the manual ;)

(btw thanks for this very useful library !)

Synxis avatar Jul 28 '22 13:07 Synxis