Code QuizAdvanced

Missing const Assertion Widens Literal

An object literal's method property widens to string and no longer matches the union.

Codetypescript
const config = {
  method: "GET"
};

function request(opts: { method: "GET" | "POST" }) {}

request(config);

Why does `request(config)` produce a type error?