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
Type 'ISyncableObject<object> & T' does not satisfy the constraint 'ISyncableObject<object>'.
Property 'foo' is missing in type 'ISyncableObject<object> & T' but required in type 'ISyncableObject<object>'.(2344)
vilicvane
changed the title
Unexpected intersection type constraint error related to primitive union, generic type and private field
Unexpected intersection type constraint error related to union, generic type and private field
Apr 30, 2020
Actually, looks to be caused by #37537. We currently say that unions of object types never contain private or protected members. But that isn't quite right. A union of object types should contain any private or protected member that is present in every constituent and originates in exactly the same declaration. This rarely matters, but in this particular case we end up structurally relating the union ISyncableObject & object | ISyncableObject & string to ISyncableObject, and that fails (but shouldn't) because of the private member.
TypeScript Version: 3.9.1-rc/4.0.0-dev.20200428
3.9.0-beta seems to be fine.
Search Terms: intersection,private,generic,constraint,union
Code
Expected behavior: No error
Actual behavior:
Playground Link: Playground
Related Issues:
The text was updated successfully, but these errors were encountered: