I have a project which is completely in C++. Also I have one more file which is in typescript ( I wasn't able to find libraries equilvelent in C++). The typescript file is doing the following: 1 It has typescript CLI code kinda of generator that will generate some functions in respective files.
My compiler is gcc.
Can please someone tell me .. is it possible to link and compile it ? Is yes..How ?
tl;dr provide a node executable and use spawn a
node myfile.jsfrom your programYou (generally) can't compile typescript into bytecode, it will always be a .JS text file executed with
#!/usr/bin/env nodeIf you want to run JS from C++, the easiest way is to exec or spawn node process
If you want to run C++ from JS, the easiest way is to exec or spawn c++ process, but if you want to dig into that look for how to make bindings for node https://nodejs.org/api/addons.html