TypeScript/tests/cases/compiler/objectFreeze.ts

13 lines
321 B
TypeScript
Raw Normal View History

2016-11-22 08:27:18 +01:00
const f = Object.freeze(function foo(a: number, b: string) { return false; });
f(1, "") === false;
2016-11-23 18:48:25 +01:00
class C { constructor(a: number) { } }
const c = Object.freeze(C);
new c(1);
2016-11-22 08:27:18 +01:00
const a = Object.freeze([1, 2, 3]);
2016-11-23 18:48:25 +01:00
a[0] = a[2].toString();
2016-11-22 08:27:18 +01:00
const o = Object.freeze({ a: 1, b: "string" });
2016-11-23 18:48:25 +01:00
o.b = o.a.toString();