Converts JASS into TypeScript. Available online at https://voces.github.io/jass-to-ts/
npm install jass-to-tsGenerated code should mostly be valid, though will require manual cleanup to
fix nulled handles. In most cases this means you can just delete the offending
line. More on this below.
```
npm i -g jass-to-ts
jass-to-ts path/to/war3map.j > war3map.ts
Here is an example. Given the following JASS:
`jass`
function my_func takes nothing returns nothing
local unit u = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
call RemoveUnit(u)
set u = null
endfunction
jass-to-ts generates the following TypeScript:
`typescript`
const my_func = (): void => {
let u = CreateUnit(Player(0), FourCC("hfoo"), 0, 0, 0);
RemoveUnit(u)
u = null;
};
The type information of u is unit, which is incompatible with null. In
this case we were just trying to clean up a local leak, which doesn't occur
in TypeScript/Lua, so the line can just be deleted.
, you may also find null issues in some function
calls. For example:`typescript
TimerStart(myTimer, 15, false, null);
`The fourth argument,
handlerFunc, expects a function, but we passed null.
Here you'll want to pass an empty function, such as
() => { / does nothing / }`.