Skip to content

Сулейманов Эмиль#9

Open
theSweater23 wants to merge 2 commits intoRTF-Angular-2021:masterfrom
theSweater23:suleymanov_emil
Open

Сулейманов Эмиль#9
theSweater23 wants to merge 2 commits intoRTF-Angular-2021:masterfrom
theSweater23:suleymanov_emil

Conversation

@theSweater23
Copy link

No description provided.

type numOrDate = Date | number;
type BarType = {stringsArrayProp: Array<string>, numbersOrDatesArrayProp: Array<numOrDate>, functionProp: Function};
type FooType = {stringProp: string, numberProp: number, barObject: BarType};

Copy link

Choose a reason for hiding this comment

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

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

}

console.log(add('20', '21')); //2021
console.log(add(20, 21)); //41 No newline at end of file
Copy link

Choose a reason for hiding this comment

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

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

// 3) В интерфейсы можно добавить поля после создания, а в type нет
// https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces

// 4) Интерфейсы не могут расширять объединение type
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