The literal is checked where you wrote it. The variable is not.
The common read: the check is a property of the object, so a value that fails a shape check fails it wherever I write it.
Excess property checking is not part of assignability, it is a second check laid on top of it, and it fires only on an object literal at the point that literal is assigned or passed.
That is why the two lines behave differently, and it is also why the compiler can afford to be helpful there and nowhere else: a literal written against a known target is the one place where an unknown key is almost certainly a typo rather than an intentional extra field, so you get a spelling suggestion instead of a member-list comparison. There are three documented ways around the check and they are not equal.
A type assertion says you have decided; a string index signature says the shape genuinely accepts arbitrary extra keys, and it is the only one of the three that changes the type rather than dodging the question; and assigning through a variable is the accidental one, because nobody reaches for it as a workaround, they reach for it because the config needed a line of preparation and the check quietly stopped applying.
The symptom is a support ticket that says the dark theme flag does nothing on the settings page, filed against the theme service, whose author reads the call site, sees a key with the right name in it, and closes it as unreproducible.
