You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a given type T, and an instance variable declared as of type DeepPartial<T>, an instance of T should be assignable to the instance variable of type DeepPartial<T>, but with the current implementation this is violated.
The problem is an overly simplisitic DeepPartial definition, there are better implementations out there. NB: I believe the implementation prior to #3369 did not have this problem (but obviously that PR addressed other issues).
Steps to Reproduce
// Money is a "branded" stringtypeMoney=string&{__brand: "Money"};exportinterfaceTransaction{amount: Money;postedDateTime: string;}letfoo: DeepPartial<Transaction>={postedDateTime: "2019-11-01"};constbar: Transaction={amount: "300.50"asMoney,postedDateTime: "2019-11-02"};foo=bar;// barfs with compile error
Prior Issues
DeepPartial
breaks when usingunknown
#3368What is the current behavior?
Assume some simple branded type, for example
Assume some type, e.g.
Transaction
that makes use of the branded type in a property, for exampleFor a given type
T
, and an instance variable declared as of typeDeepPartial<T>
, an instance ofT
should be assignable to the instance variable of typeDeepPartial<T>
, but with the current implementation this is violated.The problem is an overly simplisitic
DeepPartial
definition, there are better implementations out there. NB: I believe the implementation prior to #3369 did not have this problem (but obviously that PR addressed other issues).Steps to Reproduce
The error:
What is the expected behavior?
An instance of
T
is assignable to a variable of typeDeepPartial<T>
, even ifT
includes properties that are branded strings / branded numbers.Environment Details
Redux
4.1.2
TypeScript
4.5.2
Unsure as to whether it worked with previous versions of Redux.
The text was updated successfully, but these errors were encountered: