Skip to content

Instantly share code, notes, and snippets.

@LaurensRietveld
Created March 2, 2016 16:15
Show Gist options
  • Save LaurensRietveld/0bee1766c2766e93f847 to your computer and use it in GitHub Desktop.
Save LaurensRietveld/0bee1766c2766e93f847 to your computer and use it in GitHub Desktop.
Babel en TS runtime register
var test = function() {
//foo is typed, so we need ts
var foo:Function = function() {};
var bar = function baz() {};
//this comparison is not supported by ts, but it is supported by babel. So, we need babel
//See: https://kangax.github.io/compat-table/es6/#typescript , function "name" property -> variables (function)
return foo.name === "foo" && bar.name === "baz";
}
console.log(test())
require('ts-node/register')
require('babel-register')
require('./ecma6AndTs.ts');
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Laurens Rietveld <[email protected]>",
"license": "MIT",
"dependencies": {
"babel-register": "^6.6.0",
"ts-node": "^0.5.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment