Skip to content

Commit

Permalink
Use if instead of ternary in arrow function
Browse files Browse the repository at this point in the history
  • Loading branch information
v1valasvegan committed Jan 8, 2023
1 parent 4ecfcda commit c80af15
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions modules/20-functions/85-function-overloads/description.ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ theory: |
const concat: {
(a: number, b: number): string;
(a: string, b: string): string;
} = (a: unknown, b: unknown) => (
typeof a === 'string'
? `${a}${b}`
: `${a.toFixed()}${b.toFixed()}`
)
} = (a: unknown, b: unknown) => {
if (typeof a === 'number') {
return `${a.toFixed()}${b.toFixed()}`;
}
return `${a}${b}`;
}
// с использованием алиасов
type Overloaded = {
Expand Down

0 comments on commit c80af15

Please sign in to comment.