Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/25-types/60-structural-typing/en/EXERCISE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Describe the `DataState` state type and the `LoadingStatus` enumeration. Then implement a `handleData()` function that takes `DataState` as input and returns a string depending on the state: `loading...` at `LoadingStatus.loading`, `error` at `LoadingStatus.error`, a string from the numeric field `data` at `LoadingStatus.success`. If the status is not included in the enumeration, the function returns `unknown`.
Describe the `DataState` state type and the `LoadingStatus` enumeration. Then implement a `handleData()` function that takes `DataState` as input and returns a string depending on the state: `loading...` at `LoadingStatus.Loading`, `error` at `LoadingStatus.Error`, a string from the numeric field `data` at `LoadingStatus.Success`. If the status is not included in the enumeration, the function returns `unknown`.

```typescript
const loading: DataState = { status: LoadingStatus.Loading };
Expand Down
2 changes: 1 addition & 1 deletion modules/25-types/60-structural-typing/ru/EXERCISE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Опишите тип состояния `DataState` и перечисление `LoadingStatus`. Затем реализуйте функцию `handleData()`, которая принимает на вход `DataState` и возвращает строку в зависимости от состояния: `loading...` при `LoadingStatus.loading`, `error` при `LoadingStatus.error`, строку из числового поля `data` при `LoadingStatus.success`. Если статус не входит в перечисление, функция возвращает `unknown`.
Опишите тип состояния `DataState` и перечисление `LoadingStatus`. Затем реализуйте функцию `handleData()`, которая принимает на вход `DataState` и возвращает строку в зависимости от состояния: `loading...` при `LoadingStatus.Loading`, `error` при `LoadingStatus.Error`, строку из числового поля `data` при `LoadingStatus.Success`. Если статус не входит в перечисление, функция возвращает `unknown`.

```typescript
const loading: DataState = { status: LoadingStatus.Loading };
Expand Down