Spot the bug in State parsing

from Enums
TypeScript 6 intermediate 4 min 1 issue to find

Find why this generated parser does not establish a valid State.

TypeScript
enum State {
  Ready = "READY",
  Done = "DONE",
}

interface Payload {
  state: State;
}

function readState(raw: string): State {
  const payload = JSON.parse(raw) as Payload;
  return payload.state;
}
Open in playground
Report an error