Skip to content

Instantly share code, notes, and snippets.

@halferty
Last active May 7, 2018 22:03
Show Gist options
  • Save halferty/b244072faaa19ec2f349ef3b9974f814 to your computer and use it in GitHub Desktop.
Save halferty/b244072faaa19ec2f349ef3b9974f814 to your computer and use it in GitHub Desktop.
TS compiled in JS
npm install ts-node
npm install typescript
node test.js
# type in test.ts hit enter
# magic 🎩
require('ts-node').register({});
process.openStdin().addListener("data", function(d) {
const asdf = require("./" + d.toString().trim());
asdf.hello();
});
export const hello = () => console.log("hello!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment