aboutsummaryrefslogtreecommitdiff
path: root/TypeScript/ts-test1.ts
diff options
context:
space:
mode:
Diffstat (limited to 'TypeScript/ts-test1.ts')
-rw-r--r--TypeScript/ts-test1.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/TypeScript/ts-test1.ts b/TypeScript/ts-test1.ts
new file mode 100644
index 0000000..8a2b915
--- /dev/null
+++ b/TypeScript/ts-test1.ts
@@ -0,0 +1,17 @@
+class Person {
+ private _name: string;
+
+ set name(value: string) {
+ if (value == "Pesho")
+ throw new Error("Nah fam");
+ this._name = value;
+ }
+
+ get name() {
+ return this._name;
+ }
+
+ constructor(name: string) {
+ this.name = name;
+ }
+}