I am new to transpiling TypeScript to JavaScript programmatically. So far, I am using TypeScript's transpileModule()
function. This function takes a source string and transpiler options.
I wanted to pass my tsconfig.json
file as transpiler options, but this does not work, because there are slight differences (e.g. tsconfig.json
uses string enums, wherease the compiler options use JavaScript enum
enums).
Is there an easy way to convert between the two formats, e.g. like this:
transpileModule(tsString, configTsToTranspilerOptions(tsConfigJson));