Spot the bug in the event handler

from Type inference
TypeScript 6 intermediate 5 min 1 issue to find

Find why this generated handler loses the event type even though register later expects one.

TypeScript
const handler = (event) => {
  console.log(event.id.toUpperCase());
};

declare function register(
  callback: (event: { id: string }) => void,
): void;

register(handler);
Open in playground
Report an error