Skip to content

Комаров Ярослав#7

Open
YaroslavKomarov wants to merge 2 commits into
RTF-Angular-2021:masterfrom
YaroslavKomarov:Yaroslav-Komarov
Open

Комаров Ярослав#7
YaroslavKomarov wants to merge 2 commits into
RTF-Angular-2021:masterfrom
YaroslavKomarov:Yaroslav-Komarov

Conversation

@YaroslavKomarov
Copy link
Copy Markdown

No description provided.

Comment thread src/task_1/index.ts
return `result of the addition operation ${this.a} + ${this.b} = ${this.wrappee.exec()}`;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 бала, верная реализация

Comment thread src/task_2/index.ts
class Example {
@decoratorProp
public email: string = "";
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 бала

Comment thread src/task_3/index.ts Outdated
}

public register<?>(type: ?) {
public register(type: Function) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут нужно было делать использую generic-типы. не правильно

Comment thread src/task_3/index.ts
selectBoxInstance.setValue("sdfsdf") // компилятор TS не пропускает
selectBoxInstance.setValue(new SelectItem()) // компилятор TS пропускает
//selectBoxInstance.setValue("sdfsdf") // компилятор TS не пропускает
selectBoxInstance.setValue(new SelectItem()) // компилятор TS пропускает No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не верная реализация.
Метод register класса FactoryControl позволит зарегистрировать всё что угодно (а надо было только то что унаследовано от класса Control) а значит и не будет проверок компилятором TypeScript на передаваемый тип потому что там используется абстрактное ограничение Function, т.е. любой тип

Comment thread src/task_4/index.ts
const x = {
m: 12,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 бала

Comment thread src/task_5/index.ts Outdated
* Если поле не заполнено, то генерируется эксепшен.
*/
function validate(target: Object, propKey: string): any {
if (!(propKey in Object.keys(target) && (target as any)[propKey])) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

на данный момент это не работает для теста можно использовать

let example = new Example1();
example.propValueExample1 = new ValueExample1();
example.propValueExample1 = new ValueExample2();

Что бы проверить наличие свойства у объекта, можно использовать reflect-metadata или просто создать объект и посмотреть есть ли у него это поле.

Comment thread src/task_5/index.ts

@validate(ValueExample2, "booleanProp")
public propValueExample2: any;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Работает не верно

let example = new Example1();
example.propValueExample1 = new ValueExample1();
example.propValueExample1 = new ValueExample2();

попробуй проверить

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Оооооочень долго не мог понять, почему у меня проходит без проблем тест, который Вы предложили опробовать. Оказывается я определил конструкторы для ValueExample1 и 2, с присвоением значений по умолчанию и поля всегда были проинициализированны. Крч, не туда воевал

@m-abrosimov
Copy link
Copy Markdown

итого 9 балов

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants