You may use .ts
files and compile them using TypeScript for easy conversions and usage from typescript to javascript.
Please note that when using this method of development, it is essential to remove the imports from this library for correct execution in the Scriptable app itself.
All credits of documentation and further coding goes to Simon Støvring.
You can find an example project in the following repo.