Created
April 4, 2016 03:20
-
-
Save fay-jai/eb42400abe28e9cfd83bd41e6991dee3 to your computer and use it in GitHub Desktop.
Exploring Typescript Internal and External Modules
This file contains 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
namespace InternalModule { | |
export function add(...args: number[]): number { | |
return args.reduce((acc, cur) => acc + cur, 0); | |
} | |
} | |
export = InternalModule; | |
/* | |
NOTE: this is the compiled JavaScript, assuming CommonJS module format | |
"use strict"; | |
var InternalModule; | |
(function (InternalModule) { | |
function add() { | |
var args = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
args[_i - 0] = arguments[_i]; | |
} | |
return args.reduce(function (acc, cur) { return acc + cur; }, 0); | |
} | |
InternalModule.add = add; | |
})(InternalModule || (InternalModule = {})); | |
module.exports = InternalModule; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment