Skip to content

Воробьев #14

Open
garche wants to merge 1 commit intoRTF-Angular-2021:masterfrom
garche:master
Open

Воробьев #14
garche wants to merge 1 commit intoRTF-Angular-2021:masterfrom
garche:master

Conversation

@garche
Copy link

@garche garche commented Apr 1, 2021

No description provided.

{
return array.filter((x): x is FirstType | SecondType | ThirdType => typeof x === type);
}

Copy link

Choose a reason for hiding this comment

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

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

numbersOrDatesArrayProp: Array<number | Date>,
functionProp(flag: boolean): void,
};

Copy link

Choose a reason for hiding this comment

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

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

{
return x+y;
}

Copy link

Choose a reason for hiding this comment

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

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

* interface можно изменять и расширять, при создании нового interface с уже использованным именем они сольются
* в один, interface представляет именнованный тип объекта
*/

Copy link

Choose a reason for hiding this comment

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

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

export function filterUsers(persons: Person[], criteria: {type?: string, name?: string, age?: number, occupation?: string}): 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