Рефактор кода по типам, если повторяется Flashcards

1
Q

Рефактор кода по типам

A

type DeleteTodolistType = {
resultCode: number
messages: Array<string>
data: {}
}</string>

type UpdateTodolistType = {
resultCode: number
messages: Array<string>
data: {
item: TodolistTy[e
}
}</string>

Одинаковое все кроме даты, можно перезаписать в один тип.
type DeleteUpdateTodolistType<D = 0> = {
resultCode: number
messages: Array<string>
data: D
}</string>

D - можно установить дефолтное значение

How well did you know this?
1
Not at all
2
3
4
5
Perfectly