Partial type does not accept plain empty object literal as a default #9069
Labels
bug
Typing: completeness
No false positives (type checker claims that there are some errors in the correct program)
Typing: destructors
Flow version: 214
Expected behavior
The partial type also accepts object literal as a default value since it is an extreme case where all properties were omitted
<T>(Partial<T> = {}) => {}
Actual behavior
Flow throws an incompatible type error because the object literal is incompatible with
{...T}.
It can be circumvented by casting anany
type to the object.Flow try demo
The text was updated successfully, but these errors were encountered: