-
Notifications
You must be signed in to change notification settings - Fork 15
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
Сулейманов Эмиль #9
base: master
Are you sure you want to change the base?
Сулейманов Эмиль #9
Conversation
type BarType = unknown; | ||
type numOrDate = Date | number; | ||
type BarType = {stringsArrayProp: Array<string>, numbersOrDatesArrayProp: Array<numOrDate>, functionProp: Function}; | ||
type FooType = {stringProp: string, numberProp: number, barObject: BarType}; | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачтено на 3 балла
@@ -73,7 +73,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: {type?: string, name?:string, age?:number, occupation?:string}): User[] { | |||
return persons.filter(isUser).filter((user) => { | |||
const criteriaKeys = Object.keys(criteria); | |||
return criteriaKeys.every((fieldName) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачтено на 3 балла
No description provided.