K Ring Technologies Ltd

Typescript

Typescript...

Ah, after a bit of setup, some peace. So renaming the .js to .ts and changing the include in the header to .ts too, typescript becomes easy. Sure, there’s the index.d.ts to allow window.<name> assignments, and adding in a few type definition files along with the dom library.

Then there’s an ease of using Function as a callable type, or { prop?: type } for when some functions need particular properties in the JSON. That then just left the async/await hell, which can be ignored quite a bit, needing just (async () => { await ... })() as a wrapper when unsure if you should allow a Promise to pass back or not as it gives you back a normal function return.