cf.completefrontend

Predict the typesHard

What happens when you pass only some of a generic function's type arguments?

Name the type each ^? line points at, and every error TypeScript reports.

What does TypeScript report here?
function convert<From, To>(value: From, transform: (value: From) => To): To {  return transform(value);}function convertOr<From, To = unknown>(value: From, transform: (value: From) => To): To {  return transform(value);} const a = convert(42, (n) => n.toFixed(1));//    ^?const b = convert<number>(42, (n) => n.toFixed(1));const c = convertOr<number>(42, (n) => n.toFixed(1));//    ^?

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…