I’ve looked into how https://github.com/TurtleTower/Moralis-CloudCode-Boilerplate-Typescript works but I find the following problems when using its techniques to implement my own solution:
Moralisas a constant externally throws errors when it is used as a type or namespace. This is important since Cloud Code provides a number of modules without needing to define them in the script.
Lots of functions expected to work with Cloud Code either don’t work (such as
Moralis.settings) or have incorrect definitions (
Moralis.Units.Token). For tokens, the workaround was not to change the declarations but instead hunt for the source code and paste it directly.
It’s not feasible to include our own source code unless we use
webpackmanually to create a bundled JS file. Without webpack, TS files can’t be treated as modules, in which case the internal
moralis-admin-clibundles them appropriately.
I’m looking for
A proper setup for TS and Moralis Cloud Code that assumes all the modules implicitly available are not known to the IDE.
This can be similar to how
Mochais implicitly included in tests, such as those in Hardhat templates.
A proper extensive class reference in JS, which I could not find without directly referring to the source code itself, and hopefully correct type declarations in TS. These can be the basis for a class reference as well.
VS Code 1.63.2 production