conventions.io

Tech Challenge

2026-08-02

🔷

Daily Tech Challenge

TypeScript

medium
Question 1 of 5

With `strict` enabled on TypeScript 4.4+, what does the compiler do with `input.toFixed(1)` and `input.trim()` below?

Example
function format(input: string | number): string {
  const isNumber = typeof input === "number";

  if (isNumber) {
    return input.toFixed(1);
  }

  return input.trim();
}

Sunday, August 2, 2026 · A new challenge drops every day