Last active
May 7, 2018 22:03
-
-
Save halferty/b244072faaa19ec2f349ef3b9974f814 to your computer and use it in GitHub Desktop.
TS compiled in JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install ts-node | |
npm install typescript | |
node test.js | |
# type in test.ts hit enter | |
# magic 🎩 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('ts-node').register({}); | |
process.openStdin().addListener("data", function(d) { | |
const asdf = require("./" + d.toString().trim()); | |
asdf.hello(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const hello = () => console.log("hello!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment