Right now lualib is a bit hidden in the dist/ folder and will be even lesss visible in npm packages. Therefore we should automatically require lualib into projects. For that we will need to include the typings (lib-typescript.d.ts) when typescript is parsing the source file (before compilation).
Then we need to add the lualib functions to the output (during compilation), 2 possible approaches for that are:
-
Keep track of functions/classes from lualib that are used and just copy them into the Lua source file where they are used e.g: local TS_Splice = function() .....
-
Copy typescript.lua to output root directory of the compiled project. and require('typescript') in each file where the lib is used. (It would be better if we changed typescript.lua to a module structure that way we can do local = require, and utilise the module cache)
Right now lualib is a bit hidden in the dist/ folder and will be even lesss visible in npm packages. Therefore we should automatically require lualib into projects. For that we will need to include the typings (lib-typescript.d.ts) when typescript is parsing the source file (before compilation).
Then we need to add the lualib functions to the output (during compilation), 2 possible approaches for that are:
Keep track of functions/classes from lualib that are used and just copy them into the Lua source file where they are used e.g: local TS_Splice = function() .....
Copy typescript.lua to output root directory of the compiled project. and require('typescript') in each file where the lib is used. (It would be better if we changed typescript.lua to a module structure that way we can do local = require, and utilise the module cache)