Just in case, someone is crazy like me and just wants to run a script script, as if it were a .js script, you can try this. I wrote a hacker script that seems to be executing a .ts script using a node.
#!/usr/bin/env bash NODEPATH="$HOME/.nvm/versions/node/v8.11.3/bin" # set path to your node/tsc export TSC="$NODEPATH/tsc" export NODE="$NODEPATH/node" TSCFILE=$1 # only parameter is the name of the ts file you created. function show_usage() { echo "ts2node [ts file]" exit 0 } if [ "$TSCFILE" == "" ] then show_usage; fi JSFILE="$(echo $TSCFILE|cut -d"." -f 1).js" $TSC $TSCFILE && $NODE $JSFILE
You can do this or write your own, but essentially, it creates a .js file and then uses the node to run it as follows:
Simply. Just make sure your script has only one. "Otherwise, you will need to change JSFILE differently than what I showed.
Harlin Jul 06 2018-18-06T00: 00Z
source share