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
This is the behavior in every version I tried (from 3.3.3~)
In versions before satisfies was implemented, had to test with extends - same result.
β― Playground Link
No response
π» Code
interfaceC{(x:1):"1";(x:2):"20";(x:number):number;}interfaceB{(x:2):"2"(x:3):"30"(x:number):number;}interfaceA{(x:3):"3"(x:1):"10"(x:number):number;}functionfoo(x:1):"1";functionfoo(x:2):"2";functionfoo(x:3):"3";functionfoo(x:number):number|"1"|"2"|"3"{if(x==1||x==2||x==3)returnString(x)asany;returnx;}// The `&`-intersection operator result should be independent of the order of it's operands.foosatisfiesA&B&C;// error (incorrect)foosatisfiesA&C&B;// error (incorrect)foosatisfiesB&A&C;// error (incorrect)foosatisfiesB&C&A;// error (incorrect)foosatisfiesC&A&B;// error (incorrect)foosatisfiesC&B&A;// error (incorrect)// W stands for (attempted) "W"orkaroundtypeW=(A&B&C)|(A&C&B)|(B&A&C)|(B&C&A)|(C&A&B)|(C&B&A);declareconstw:W;w(1);// "1","10"w(2);// "2","20"w(3);// "3","30"foo(1);// "1"foo(2);// "2"foo(3);// "3"// So the following should pass.foosatisfiesW;// error (incorrect)// ~~~~~~~~~// Type '{ (x: 1): "1"; (x: 2): "2"; (x: 3): "3"; }' does not satisfy the expected type 'W'.// Type '{ (x: 1): "1"; (x: 2): "2"; (x: 3): "3"; }' is not assignable to type 'A & B & C'.(1360)
π Search Terms
#57087
π Version & Regression Information
satisfies
was implemented, had to test withextends
- same result.β― Playground Link
No response
π» Code
π Actual behavior
Every
satisifies
statement is failing.π Expected behavior
Every
satisifies
statement should pass.Additional information about the issue
Proposal #57087 should fix it.
The text was updated successfully, but these errors were encountered: