const example: Partial<{ a: string }> = { a: undefined };
const value = example.a; // type is string | undefined
const values = Object.values(example); // type is string[] (!?)
In the code block above, value
has type string | undefined
, but values
has type string[]
. Why is this? I would expect values
to have type Array<string | undefined>
.
Playground link with some more details