Skip to content

Commit c80af15

Browse files
committed
Use if instead of ternary in arrow function
1 parent 4ecfcda commit c80af15

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

modules/20-functions/85-function-overloads/description.ru.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ theory: |
3333
const concat: {
3434
(a: number, b: number): string;
3535
(a: string, b: string): string;
36-
} = (a: unknown, b: unknown) => (
37-
typeof a === 'string'
38-
? `${a}${b}`
39-
: `${a.toFixed()}${b.toFixed()}`
40-
)
36+
} = (a: unknown, b: unknown) => {
37+
if (typeof a === 'number') {
38+
return `${a.toFixed()}${b.toFixed()}`;
39+
}
40+
41+
return `${a}${b}`;
42+
}
4143
4244
// с использованием алиасов
4345
type Overloaded = {

0 commit comments

Comments
 (0)