Type guard cannot remove undefined
from Partial<T>[keyof T] | undefined
#45257
Labels
Suggestion
An idea for TypeScript
Bug Report
When writing a function to merge object
A
with non-undefined values from objectB
intoC
whereA
is of typeT
and B is of typePartial<T>
, I came across a situation where the type guard seems to be failing.🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
There is an error at
v[key] = value;
:Clearly
value
is NOTundefined
, yet the compiler complains that it is.🙂 Expected behavior
I would expect that the code compiled.
The text was updated successfully, but these errors were encountered: