/typescript/

TypeScript part 6 (module)

2017-03-02 21:55:30

TypeScript

module Utility {
    export class util {
        getName(s: string): string {
            return "Text:" + s;
        }
    }
}

TypeScript

/// 

<reference path='"UtilityModule.ts"'></reference>

var util = new Utility.util();
console.log(util.getName("Lorem"));

JavaScript

var Utility;
(function (Utility) {
    var util = (function () {
        function util() {
        }
        util.prototype.getName = function (s) {
            return "Text:" + s;
        };
        return util;
    }());
    Utility.util = util;
})(Utility || (Utility = {}));

// ---------------------------

var util = new Utility.util();
console.log(util.getName("Lorem"));