From 85b75410a0cae77b482a7c0bd11bc1203c5fdd39 Mon Sep 17 00:00:00 2001 From: User Date: Thu, 30 Dec 2021 22:02:35 +0500 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BE=D1=80=D0=BE=D0=B1=D1=8C=D0=B5?= =?UTF-8?q?=D0=B2=D0=B0=20=D0=9A=D1=80=D0=B8=D1=81=D1=82=D0=B8=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/task-1/app.ts | 3 +++ src/task-1/index.html | 3 ++- src/task-1/typing.dt.ts | 8 ++++++++ src/task-2/Example.ts | 12 ++++++++++++ src/task-2/Setting.ts | 12 ++++++++++++ src/task-2/SettingValue.ts | 11 +++++++++++ src/task-2/index.html | 10 ++++++++++ src/task-2/index.ts | 37 ++++++++----------------------------- 8 files changed, 66 insertions(+), 30 deletions(-) create mode 100644 src/task-1/app.ts create mode 100644 src/task-1/typing.dt.ts create mode 100644 src/task-2/Example.ts create mode 100644 src/task-2/Setting.ts create mode 100644 src/task-2/SettingValue.ts create mode 100644 src/task-2/index.html diff --git a/src/task-1/app.ts b/src/task-1/app.ts new file mode 100644 index 0000000..f906be9 --- /dev/null +++ b/src/task-1/app.ts @@ -0,0 +1,3 @@ +Custom.user.upAgeByYear(); +console.log(Custom.user); +console.log(Custom.user.name, Custom.user.age); \ No newline at end of file diff --git a/src/task-1/index.html b/src/task-1/index.html index 2fde2d2..3dce073 100644 --- a/src/task-1/index.html +++ b/src/task-1/index.html @@ -32,6 +32,7 @@ })(Custom || (Custom = {})); Custom.user.upAgeByYear(); + - + \ No newline at end of file diff --git a/src/task-1/typing.dt.ts b/src/task-1/typing.dt.ts new file mode 100644 index 0000000..5ed0f9d --- /dev/null +++ b/src/task-1/typing.dt.ts @@ -0,0 +1,8 @@ +export declare namespace Custom { + interface User { + age: number; + name: string; + upAgeByYear(): void; + } + export let user: User; +} \ No newline at end of file diff --git a/src/task-2/Example.ts b/src/task-2/Example.ts new file mode 100644 index 0000000..e3a89d3 --- /dev/null +++ b/src/task-2/Example.ts @@ -0,0 +1,12 @@ +import {Setting} from "./Setting"; + +class Example { + public title: string; + public id: number; + private _setting: Setting; + + constructor(s: Setting) { + this._setting = s; + } +} +export { Example }; \ No newline at end of file diff --git a/src/task-2/Setting.ts b/src/task-2/Setting.ts new file mode 100644 index 0000000..cecbf81 --- /dev/null +++ b/src/task-2/Setting.ts @@ -0,0 +1,12 @@ +import { SettingValue } from "./SettingValue"; + +class Setting { + public key: string; + public value: SettingValue; + + constructor(k: string, ov: SettingValue) { + this.key = k; + this.value = ov; + } +} +export { Setting }; \ No newline at end of file diff --git a/src/task-2/SettingValue.ts b/src/task-2/SettingValue.ts new file mode 100644 index 0000000..9eabad1 --- /dev/null +++ b/src/task-2/SettingValue.ts @@ -0,0 +1,11 @@ +class SettingValue { + public property1: string; + public property2: string; + + constructor(p1: string, p2: string) { + this.property1 = p1; + this.property2 = p2; + } +} + +export { SettingValue }; \ No newline at end of file diff --git a/src/task-2/index.html b/src/task-2/index.html new file mode 100644 index 0000000..cfb0de7 --- /dev/null +++ b/src/task-2/index.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/src/task-2/index.ts b/src/task-2/index.ts index d5d9639..74c81f1 100644 --- a/src/task-2/index.ts +++ b/src/task-2/index.ts @@ -6,33 +6,12 @@ * все остальные файлы должны подгрузиться асинхронно по цепочке, используя requireJS. */ -class SettingValue { - public property1: string; - public property2: string; +import {SettingValue} from "./SettingValue"; +import {Setting} from "./Setting"; +import {Example} from "./Example"; - constructor(p1: string, p2: string) { - this.property1 = p1; - this.property2 = p2; - } -} - -class Setting { - public key: string; - public value: SettingValue; - - constructor(k: string, ov: SettingValue) { - this.key = k; - this.value = ov; - } -} - - -class Example { - public title: string; - public id: number; - private _setting: Setting; - - constructor(s: Setting) { - this._setting = s; - } -} +const example = new Example(new Setting('очень', new SettingValue('слож', 'но'))); +example.id = 100 +example.title = 'капец' +console.log(example.id) +console.log(example.title) \ No newline at end of file