Make Typescript less typesafe

Adam Crockett ๐ŸŒ€ - Aug 5 '21 - - Dev Community

I am using Typescript to give VSCode some idea of what my Rhino JavaScript (Java JavaScript) is doing, I am not using Typescript sources, I am still using JavaScript files with checkJS turned on.

(I know it sounds terrible but I know the risk, all safety off)

I have several scripts executed in a sandbox with injected variables that includes the entire Java OpenJDK, I dont want to provide typedefs for this, but I do want to provide some hints, what can I do to make TS not care about 1000's of globally injected variables and objects.

Short of building Typedefs from Java (Done this it too 5 hours to build, its not going to work)

I want to do this:

java.io.readFile(); // < TS wont care about this

context.outcome; // hey TS there is this thing I have defined, its a boolean

(2).map(); // TS this isn't right!
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .