2014-07-13 01:04:16 +02:00
|
|
|
//// [staticMemberExportAccess.ts]
|
|
|
|
class Sammy {
|
|
|
|
foo() { return "hi"; }
|
|
|
|
static bar() {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module Sammy {
|
|
|
|
export var x = 1;
|
|
|
|
}
|
|
|
|
interface JQueryStatic {
|
|
|
|
sammy: Sammy; // class instance
|
|
|
|
}
|
|
|
|
var $: JQueryStatic;
|
|
|
|
var instanceOfClassSammy: Sammy = new $.sammy(); // should be error
|
|
|
|
var r1 = instanceOfClassSammy.foo(); // r1 is string
|
|
|
|
var r2 = $.sammy.foo();
|
|
|
|
var r3 = $.sammy.bar(); // error
|
|
|
|
var r4 = $.sammy.x; // error
|
|
|
|
|
|
|
|
Sammy.bar();
|
|
|
|
|
|
|
|
//// [staticMemberExportAccess.js]
|
|
|
|
var Sammy = (function () {
|
|
|
|
function Sammy() {
|
|
|
|
}
|
2015-02-07 05:03:24 +01:00
|
|
|
Sammy.prototype.foo = function () { return "hi"; };
|
2014-07-13 01:04:16 +02:00
|
|
|
Sammy.bar = function () {
|
|
|
|
return -1;
|
|
|
|
};
|
|
|
|
return Sammy;
|
|
|
|
})();
|
|
|
|
var Sammy;
|
|
|
|
(function (Sammy) {
|
|
|
|
Sammy.x = 1;
|
|
|
|
})(Sammy || (Sammy = {}));
|
|
|
|
var $;
|
2014-08-15 22:18:54 +02:00
|
|
|
var instanceOfClassSammy = new $.sammy(); // should be error
|
|
|
|
var r1 = instanceOfClassSammy.foo(); // r1 is string
|
2014-07-13 01:04:16 +02:00
|
|
|
var r2 = $.sammy.foo();
|
2014-08-15 22:18:54 +02:00
|
|
|
var r3 = $.sammy.bar(); // error
|
|
|
|
var r4 = $.sammy.x; // error
|
2014-07-13 01:04:16 +02:00
|
|
|
Sammy.bar();
|