diff --git a/src/task_1/app.ts b/src/task_1/app.ts new file mode 100644 index 0000000..3ab0837 --- /dev/null +++ b/src/task_1/app.ts @@ -0,0 +1,15 @@ +var Custom; + (function (Custom) { + var User = /** @class */ (function () { + function User(a, n) { + this.age = a; + this.name = n; + } + User.prototype.upAgeByYear = function () { + this.age++; + }; + return User; + }()); + Custom.user = new User(18, "Михаил"); + })(Custom || (Custom = {})); + Custom.user.upAgeByYear(); \ No newline at end of file diff --git a/src/task_1/typing.d.ts b/src/task_1/typing.d.ts new file mode 100644 index 0000000..e30efc6 --- /dev/null +++ b/src/task_1/typing.d.ts @@ -0,0 +1,7 @@ +declare class User +{ + public a: number; + public n: string; + constructor(a: number, n: string); + public upAgeByYear(): void; +} \ 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..04b3565 --- /dev/null +++ b/src/task_2/Example.ts @@ -0,0 +1,11 @@ +/**import { Setting } from './Setting'*/ + +class Example { + public title: string; + public id: number; + private _setting: Setting; + + constructor(s: Setting) { + this._setting = s; + } +} \ 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..15a40b0 --- /dev/null +++ b/src/task_2/Setting.ts @@ -0,0 +1,11 @@ +/**import { SettingValue } from '.SettingValue'*/ + +class Setting { + public key: string; + public value: SettingValue; + + constructor(k: string, ov: SettingValue) { + this.key = k; + this.value = ov; + } +} \ 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..9899c1d --- /dev/null +++ b/src/task_2/SettingValue.ts @@ -0,0 +1,9 @@ +class SettingValue { + public property1: string; + public property2: string; + + constructor(p1: string, p2: string) { + this.property1 = p1; + this.property2 = p2; + } +} \ 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..5495715 --- /dev/null +++ b/src/task_2/index.html @@ -0,0 +1,15 @@ + + + + + + Заголовок + + + + + + + \ No newline at end of file diff --git a/src/task_2/index.ts b/src/task_2/index.ts index a2fa801..a7d5131 100644 --- a/src/task_2/index.ts +++ b/src/task_2/index.ts @@ -6,7 +6,8 @@ * все остальные файлы должны подгрузиться асинхронно по цепочке, используя requireJS. */ -class SettingValue { +/** + * class SettingValue { public property1: string; public property2: string; @@ -36,3 +37,5 @@ class Example { this._setting = s; } } + */ + diff --git a/src/task_3/index.ts b/src/task_3/index.ts index 04eaab2..cb46a14 100644 --- a/src/task_3/index.ts +++ b/src/task_3/index.ts @@ -16,7 +16,7 @@ class HttpError extends Error { } } -function req(url: string): Promise { + function req(url: string): Promise { return fetch(url) .then((response: Response) => { if (response.status == 200) { @@ -28,7 +28,7 @@ function req(url: string): Promise { } // Запрашивать логин, пока github не вернёт существующего пользователя. -function getGitHub() { + function getGitHub() { let name = prompt("Введите логин на GitHub?", ""); return req(`https://api.github.com/users/${name}`)