When handling possibly-null/undefined/empty inputs, be explicit about nullability and keep code aligned with the promised types/semantics.

Practical rules:

Example pattern:

function getStylesFromDbInfo(dbInfoItem) {
  return dbInfoItem?.styles ?? ''; // always a string
}

function useHtmlLabels(node, config) {
  // preserves false when it matters; only falls back on null/undefined
  return node.useHtmlLabels ?? config.flowchart.htmlLabels;
}

function getTasks(rawTasks, dateRange) {
  if (dateRange === '') return rawTasks; // early return on empty input

  // parse defensively
  const [startStr, endStr] = dateRange.split(',');
  // only use pieces if present
}

This reduces null/reference bugs and prevents subtle behavior changes caused by incorrect falsy-vs-nullish handling or mismatched return contracts.