From a04948e93a75a5aaf0bed796b028b4215d6b27c0 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 29 Oct 2021 16:13:22 +0300 Subject: Added old self learning typescript files --- TypeScript/ts-test1.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 TypeScript/ts-test1.ts (limited to 'TypeScript/ts-test1.ts') 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; + } +} -- cgit v1.2.3