Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/task-1/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Custom.user.upAgeByYear();
console.log(Custom.user);
console.log(Custom.user.name, Custom.user.age);
3 changes: 2 additions & 1 deletion src/task-1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
})(Custom || (Custom = {}));
Custom.user.upAgeByYear();
</script>
<script src="app.js"></script>
</body>

</html>
</html>
8 changes: 8 additions & 0 deletions src/task-1/typing.dt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export declare namespace Custom {
interface User {
age: number;
name: string;
upAgeByYear(): void;
}
export let user: User;
}
12 changes: 12 additions & 0 deletions src/task-2/Example.ts
Original file line number Diff line number Diff line change
@@ -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 };
12 changes: 12 additions & 0 deletions src/task-2/Setting.ts
Original file line number Diff line number Diff line change
@@ -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 };
11 changes: 11 additions & 0 deletions src/task-2/SettingValue.ts
Original file line number Diff line number Diff line change
@@ -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 };
10 changes: 10 additions & 0 deletions src/task-2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script data-main="./index.js" src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
</body>
</html>
37 changes: 8 additions & 29 deletions src/task-2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)