forked from basarat/typescript-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadonly.js
99 lines (99 loc) · 2.62 KB
/
readonly.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Simple;
(function (Simple) {
function foo(config) {
}
var config = { bar: 123, bas: 123 };
foo(config);
})(Simple = exports.Simple || (exports.Simple = {}));
var Type;
(function (Type) {
var foo = { bar: 123, bas: 456 };
foo.bar = 456;
})(Type = exports.Type || (exports.Type = {}));
var Class;
(function (Class) {
var Foo = (function () {
function Foo() {
this.bar = 1;
this.baz = "hello";
}
return Foo;
}());
})(Class = exports.Class || (exports.Class = {}));
var ReactEx;
(function (ReactEx) {
;
var Something = (function (_super) {
__extends(Something, _super);
function Something() {
_super.apply(this, arguments);
}
return Something;
}(React.Component));
ReactEx.Something = Something;
})(ReactEx = exports.ReactEx || (exports.ReactEx = {}));
var Seamless;
(function (Seamless) {
var foo = { 0: 123, 2: 345 };
console.log(foo[0]);
foo[0] = 456;
})(Seamless = exports.Seamless || (exports.Seamless = {}));
var SeamlessArray;
(function (SeamlessArray) {
var foo = [1, 2, 3];
console.log(foo[0]);
foo.push(4);
foo = foo.concat([4]);
})(SeamlessArray = exports.SeamlessArray || (exports.SeamlessArray = {}));
var ClassGetter;
(function (ClassGetter) {
var Person = (function () {
function Person() {
this.firstName = "John";
this.lastName = "Doe";
}
Object.defineProperty(Person.prototype, "fullName", {
get: function () {
return this.firstName + this.lastName;
},
enumerable: true,
configurable: true
});
return Person;
}());
var person = new Person();
console.log(person.fullName);
person.fullName = "Dear Reader";
})(ClassGetter = exports.ClassGetter || (exports.ClassGetter = {}));
var vsconst;
(function (vsconst) {
var foo = 123;
var bar;
})(vsconst || (vsconst = {}));
var aliasing;
(function (aliasing) {
var foo = {
bar: 123
};
function iMutateFoo(foo) {
foo.bar = 456;
}
iMutateFoo(foo);
console.log(foo.bar);
})(aliasing || (aliasing = {}));
var aliasing2;
(function (aliasing2) {
var foo = {
bar: 123
};
function iTakeFoo(foo) {
foo.bar = 456;
}
iTakeFoo(foo);
})(aliasing2 || (aliasing2 = {}));