DEV Community

Discussion on: Make Typescript less typesafe

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Ah C# I plan to try this out one day, but as a close relative of TS In terms of parentage, I can see the appeal.

Most of the time TS works fine but there's always a... "Hang on I don't need to protect this bit, it's already safe" or you may need an any.

In the early days I used Typescript for everything but now I use of for stuff that will be maintained, preferring prototype work in JavaScript.

Anyway for this task I have turned on type checking in js and not wrote a single TS file, only including a tsconfig file, not standard stuff, the JavaScript is executed in a sandbox ran from the Java side and we are injecting variables into that context, the entire Java stdlib is just too much to write out by hand but I do want some of the good bits...

It's too complex I fear, I may try flowtype instead, see how that works

Collapse
 
ssimontis profile image
Scott Simontis

I feel like your best bet to "do it the rightish way" would be creating some sort of code generator which could either parse the Java stdlib, pull method signatures from library files, or maybe even read code-completion data from another IDE like Eclipse. But I can see that getting out of hand and becoming a thesis project really quickly, haha.

I have used Flow before, and there is definitely a lot less support in terms for editor/IDE extensions, and I had the impression that the project had lost a lot of steam.

Thanks for posting this adventure though, I always love reading the insightful questions you post!

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

Oh man the result of this was a 5 hour build job, even declaring all the globals as any from the Java stdlib was really slow for the language server and vscode to handle. Unserpising.. I think I will give up on this for now