```ts
/**
 * Counts the distinct ways to cover a grid two cells tall and width cells wide,
 * completely and without overlap, using one-by-two dominoes (laid upright or flat)
 * and two-by-two squares.
 * @param width - The width of the grid.
 * @returns The number of distinct coverings.
 * @throws Error if width is negative or not a whole number.
 */
export function countStripTilings(width: number): number {
  if (!Number.isInteger(width) || width < 0) {
    throw new Error("Width must be a non-negative integer.");
  }

  // Base cases
  if (width === 0) return 1;
  if (width === 1) return 1;

  // DP array to store the number of ways to tile up to each width
  const dp = [1, 1];

  // Fill the DP array using the recurrence relation
  for (let i = 2; i <= width; i++) {
    dp[i] = dp[i - 1] + dp[i - 2] + 2 * dp[i - 3];
  }

  return dp[width];
}
```