Skip to content

Instantly share code, notes, and snippets.

@podhmo
Created December 30, 2015 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save podhmo/054187ba3caf7cfb3802 to your computer and use it in GitHub Desktop.
Save podhmo/054187ba3caf7cfb3802 to your computer and use it in GitHub Desktop.
function add(x, y) {
return x + y;
}
exports.add = add;
export function add(x:number, y:number): number {
return x + y;
}
{
"name": "tmp3",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "tsc -t es5 -m commonjs add.ts",
"test": "mocha --reporter=dot test.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"mocha": "^2.3.4",
"typescript": "^1.7.5"
}
}
var assert = require('assert');
it("add 3 + 3 = 6", function(){
var add = require('./add').add;
assert.strictEqual(add(3, 3), 6);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment