Question:I have the following two types
descis printed out but I get this error in vs code. I could avoid this error by casting the
SortOptionobject to any
SortOptionas this type:
item.valuemight be a
stringor it might be a
Record<string, 'desc' | 'asc'>.
For instance, this is also a valid
Recordyou have to prove it is one first at runtime in order to narrow down the type.
If you have better answer, please add a comment about this, thank you!