Typescript: type narrowing not working for `in` when key is stored in a variable

This is essentially the same issue as microsoft/TypeScript#10530; type narrowing from control flow analysis only happens for properties that are directly literals like “b” and not for arbitrary expressions whose types are literal types. Issue #10530 talks about narrowing via property access… like a.b or a[“b”], which does cause a to be narrowed, vs a[key], … Read more