cf.completefrontend

Predict the typesHard

Which of these does TypeScript type as never?

Both functions always throw. Name the type each ^? line points at, and say whether TypeScript reports any errors.

What does TypeScript report here?
function fail(message: string) {  throw new Error(message);}const stop = (message: string) => {  throw new Error(message);}; type Impossible = string & number;//   ^?const a = fail;//    ^?const b = stop;//    ^? function kind(value: string | number) {  if (typeof value === "string") return "text";  if (typeof value === "number") return "number";  return value;  //     ^?}

Work it out first: the compiler shows every error and type.

The answer

Work out every error TypeScript reports and every type it shows, line by line. Then check.

Checking your sign-in…