Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Дюкин Петр, ts-1 #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Дюкин Петр, ts-1 #7

wants to merge 1 commit into from

Conversation

diukin
Copy link

@diukin diukin commented Apr 1, 2021

No description provided.

@diukin diukin changed the title Дкюин Петр, ts-1 Дюкин Петр, ts-1 Apr 1, 2021
stringsArrayProp: string[],
numbersOrDatesArrayProp: Array<number | Date>,
functionProp: Function
};

Copy link

Choose a reason for hiding this comment

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

Зачтено на 3 балла

array.forEach(item => {
if (typeof item === type) res.push(item)
});
return res;
}
Copy link

Choose a reason for hiding this comment

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

Работать не будет, т.к. в рантайме у x будет тип Object => ни один объект не попадет результирующий массив

function add(x: number, y: number): number;
function add(x: string | number, y: string | number): string | number {
return typeof x === "string" ? <string>x + <string>y : <number>x + <number>y;
}

Copy link

Choose a reason for hiding this comment

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

Зачтено на 3 балла

* мое понимание в их различии стало именно таким. Думаю, что нет смысла копировать и переводить
* материал оттуда, да и врать, что взял все это из головы - тоже..)
* В любом случае извините...)
*/
Copy link

Choose a reason for hiding this comment

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

Зачтено на 3 балла

@@ -73,7 +74,7 @@ export function logPerson(person: Person) {
console.log(` - ${person.name}, ${person.age}, ${additionalInformation}`);
}

export function filterUsers(persons: Person[], criteria: User): User[] {
export function filterUsers(persons: Person[], criteria: HybridUser): User[] {
return persons.filter(isUser).filter((user) => {
const criteriaKeys = Object.keys(criteria);
return criteriaKeys.every((fieldName) => {
Copy link

Choose a reason for hiding this comment

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

Зачтено на 3 балла

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