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
{{ message }}
Repository navigation
Unsound calls allowed on a function coming from a deferred indexed access when intersection is involvedΒ #54824
typeA={type: "A";value: string;};typeB={type: "B";value: number;};typeMessage=A|B;exportfunctionhandle<MextendsMessage>(callbacks: {[KinM["type"]]: (msg: (M&{type: K})["value"])=>unknown;}){window.addEventListener("message",(event)=>{constmsg=event.dataasM;// should be an error because it's too permissivecallbacks[msg.typeaskeyoftypeofcallbacks](msg.value);// one or the other must be wrong herecallbacks[msg.typeaskeyoftypeofcallbacks]("");callbacks[msg.typeaskeyoftypeofcallbacks](100);});}
π Actual behavior
There is no error even though it should be based on Ander's comment here. Note that the comment is about a different variant of this signature, one using Extract. Both the Extract and intersection variants are essentially the same though - one errors today and one doesn't.
π Expected behavior
I would expect to get an error here, just like in the Extract-based variant (TS playground)
Activity