Simplify comparisons with undefined

This commit is contained in:
Robert
2023-07-03 10:51:52 +01:00
parent 08a8d6396c
commit f0af593b67

View File

@@ -13,7 +13,7 @@ export function AlertTableHeader({
sortState?: InterpretedResultsSortState;
}) {
const sortClass = useCallback((): string => {
if (sortState !== undefined && sortState.sortBy === "alert-message") {
if (sortState?.sortBy === "alert-message") {
return sortState.sortDirection === SortDirection.asc
? "sort-asc"
: "sort-desc";
@@ -26,7 +26,7 @@ export function AlertTableHeader({
| InterpretedResultsSortState
| undefined => {
const prevDirection =
sortState && sortState.sortBy === "alert-message"
sortState?.sortBy === "alert-message"
? sortState.sortDirection
: undefined;
const nextDirection = nextSortDirection(prevDirection, true);